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 |
|---|---|---|---|---|---|
import math
# Проверка числа на простоту.
def check(N):
for i in range(2, round(math.sqrt(N))+1):
if N % i == 0:
return False
return True
# Тесты.
print(check(int(input())))
| alekseik1/python_mipt_study_1-2 | 2sem/credit_tasks/zero-questions/6.py | Python | gpl-3.0 | 209 |
"""
xModule implementation of a learning sequence
"""
# pylint: disable=abstract-method
import json
import logging
from pkg_resources import resource_string
import warnings
from lxml import etree
from xblock.core import XBlock
from xblock.fields import Integer, Scope, Boolean, Dict
from xblock.fragment import Fragme... | nttks/edx-platform | common/lib/xmodule/xmodule/seq_module.py | Python | agpl-3.0 | 13,629 |
"""
Tests for Studio Course Settings.
"""
import datetime
import json
import copy
import mock
from mock import patch
from django.utils.timezone import UTC
from django.test.utils import override_settings
from django.conf import settings
from models.settings.course_details import (CourseDetails, CourseSettingsEncoder)
... | c0710204/edx-platform | cms/djangoapps/contentstore/tests/test_course_settings.py | Python | agpl-3.0 | 38,800 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2008 Johann Prieur <[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 optio... | emesene/papyon | papyon/service/AddressBook/scenario/contacts/block_contact.py | Python | gpl-2.0 | 2,343 |
from .linetool import LineTool, ThickLineTool
from .recttool import RectangleTool
from .painttool import PaintTool
| stefanv/register_gui | viewer/canvastools/__init__.py | Python | bsd-3-clause | 115 |
# -*-coding:utf-8 -*-
'''
dac的@indicator版本
提供更简单的使用方式和实现方式
'''
import operator
from collections import (
deque,
)
from .base import (
BaseObject,
fcustom,
indicator,
icache,
t2order_if,
)
from .dac import (
XBASE, #100
... | blmousee/pyctp | example/pyctp/dac2.py | Python | mit | 22,134 |
class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
O(logn)
"""
low = 0
high = len(nums) - 1
if target <= nums[low]:
return low
if target > nums[high]:
... | comicxmz001/LeetCode | Python/35. Search Insert Position.py | Python | mit | 973 |
# coding=utf-8
# Copyright 2016 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 by app... | S-YOU/grumpy | compiler/stmt_test.py | Python | apache-2.0 | 18,304 |
#!/usr/bin/env python
# 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 the hope that i... | avocado-framework-tests/avocado-misc-tests | cpu/pvr.py | Python | gpl-2.0 | 4,205 |
import collections
import copy
import logging
import asyncio
from aiozk import exc
from .iterables import drain
log = logging.getLogger(__name__)
class States:
CONNECTED = "connected"
SUSPENDED = "suspended"
READ_ONLY = "read_only"
LOST = "lost"
class SessionStateMachine:
valid_transitions... | tipsi/aiozk | aiozk/states.py | Python | mit | 2,280 |
# Copyright 2012 Pinterest.com
#
# 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,... | ewdurbin/pymemcache | pymemcache/client/base.py | Python | apache-2.0 | 39,766 |
import pygraphviz as pgv
import random
import rag_custom
random.seed(1)
class Graph(object):
def __init__(self, n):
# TODO : Why shoukd this be a list, can't this be a dict as well
# Number of vertices do not remain the same
self.rows = [{} for i in range(n)]
self.edge_count = 0
... | vighneshbirodkar/skimage-graph | graph_custom.py | Python | mit | 2,443 |
"""
missing types & inference
"""
import numpy as np
from pandas._config import get_option
from pandas._libs import lib
import pandas._libs.missing as libmissing
from pandas._libs.tslibs import NaT, iNaT
from .common import (
_NS_DTYPE,
_TD_DTYPE,
ensure_object,
is_bool_dtype,
is_complex_dtype,
... | toobaz/pandas | pandas/core/dtypes/missing.py | Python | bsd-3-clause | 15,772 |
# $Id$
"""
This is a comment
"""
__RCSID__ = "$Revision: 1.19 $"
# $Source: /tmp/libdirac/tmp.stZoy15380/dirac/DIRAC3/DIRAC/Core/Workflow/Module.py,v $
import copy
import new, sys, os
#try: # this part to import as part of the DIRAC framework
from DIRAC.Core.Workflow.Parameter import *
#RICARDO PLEASE DO NOT CH... | vmendez/DIRAC | Core/Workflow/Module.py | Python | gpl-3.0 | 11,483 |
from pylab import find
import numpy as np
from lmfit import minimize, Parameters, Parameter, report_errors
def get_histogram(var, nbins):
# quitamos nans
no_nans = ~isnan(var)
var = v... | jimsrc/seatos | etc/n_CR/opt_2/funcs.py | Python | mit | 5,218 |
# 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 agreed to in writing, ... | google/gazoo-device | gazoo_device/capabilities/interfaces/capability_base.py | Python | apache-2.0 | 6,756 |
"""
This module implements an inversion of control framework. It allows
dependencies among functions and classes to be declared with decorators and the
resulting dependency graphs to be executed.
A decorator used to declare dependencies is called a :class:`ComponentType`, a
decorated function or class is called a comp... | RedHatInsights/insights-core | insights/core/dr.py | Python | apache-2.0 | 32,029 |
from pycp2k.inputsection import InputSection
class _charge3(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Atom = None
self.Charge = None
self._name = "CHARGE"
self._keywords = {'Atom': 'ATOM', 'Charge': 'CHARGE'}
| SINGROUP/pycp2k | pycp2k/classes/_charge3.py | Python | lgpl-3.0 | 282 |
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for
# the Earth and Planetary Sciences
# Copyright (C) 2012 - 2022 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
Utils
-----
The utils submodule of BurnMan contains utility functions
that can be used by the other BurnMan ... | geodynamics/burnman | burnman/utils/__init__.py | Python | gpl-2.0 | 590 |
import warnings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Runs this project as a FastCGI application. Requires flup."
args = '[various KEY=val options, use `runfcgi help` for help]'
def handle(self, *args, **options):
warnings.warn(
"Fast... | beckastar/django | django/core/management/commands/runfcgi.py | Python | bsd-3-clause | 919 |
"""
Settings package is acting exactly like settings module in standard django projects.
However, settings combines two distinct things:
(1) General project configuration, which is property of the project
(like which application to use, URL configuration, authentication backends...)
(2) Machine-specific environ... | ella/ella-tagging | test_ella_tagging/settings/__init__.py | Python | bsd-3-clause | 904 |
from filebeat import BaseTest
import os
import time
"""
Tests for the multiline log messages
"""
class Test(BaseTest):
def test_java_elasticsearch_log(self):
"""
Test that multi lines for java logs works.
It checks that all lines which do not start with [ are append to the last line star... | christiangalsterer/httpbeat | vendor/github.com/elastic/beats/filebeat/tests/system/test_multiline.py | Python | apache-2.0 | 11,132 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
# --------------------------------------------------------------------------
# This file i... | psychopy/psychopy | psychopy/__init__.py | Python | gpl-3.0 | 2,184 |
#from sklearn.neural_network import MLPClassifier
import ast
import numpy as np
import scipy
import pickle
import os
from collections import Counter
from time import time
from collections import defaultdict
from scipy.stats import randint as sp_randint
from sklearn.model_selection import GridSearchCV
from sklearn.mo... | cs60050/TeamGabru | 2-AlexNet/MLPClassifier.py | Python | mit | 22,568 |
# /usr/bin/python3
import asyncio
import sys
from os import symlink, remove
from os.path import abspath, dirname, join, exists
from aiohttp import web
from webdash import netconsole_controller
from webdash import networktables_controller
@asyncio.coroutine
def forward_request(request):
return web.HTTPFound("/ind... | computer-whisperer/RoboRIO-webdash | webdash/main.py | Python | bsd-3-clause | 2,813 |
# -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
import gevent.monkey
gevent.monkey.patch_all()
import logging
import sys
import os
import threading
from flask import Flask, render_template, current_app
from flask_restful import Api
from walle import commands
from walle.api import ac... | meolu/walle-web | walle/app.py | Python | apache-2.0 | 7,334 |
# GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
# Copyright (c) 2016-2019 Dave Jones <[email protected]>
# Copyright (c) 2019 Ben Nuttall <[email protected]>
# Copyright (c) 2016 Andrew Scheller <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# mo... | RPi-Distro/python-gpiozero | tests/test_devices.py | Python | bsd-3-clause | 9,023 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2005,2006,2007,2008,2009 Brett Adams <[email protected]>
# Copyright (c) 2012-2015 Mario Frasca <[email protected]>
#
# This file is part of bauble.classic.
#
# bauble.classic is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | mfrasca/bauble.classic | bauble/plugins/plants/images.py | Python | gpl-2.0 | 2,233 |
from ped_core import keymap
from ped_core import clipboard
import curses
import pprint
import gc
from ped_core import editor_common
import re
from ped_core import keymap
from ped_core import keytab
import subprocess
from ped_dialog.dialog import Frame,ListBox,Toggle,Button,StaticText,Prompt,PasswordPrompt,Dialog,pad
fr... | jpfxgood/ped | tests/ped_test_util.py | Python | mit | 25,393 |
#!/usr/bin/env python
#
# Test: Schedule rules around either side of the current time with no
# particular order. This doesn't mean randomly though.
#
# Usage: python TimeSchedule_NoOrder.py
#
# Test success: Scheduled rules appear in the correct order.
# Test failure: Scheduled rules are not in the correct ord... | bakkerjarr/ACLSwitch | Tests/Time_Enforcement/Scheduling/TimeSchedule_NoOrder.py | Python | apache-2.0 | 855 |
'''
Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python train_dictnet.py
'''
from __future__ import print_function
import numpy as np
from keras.layers.core import Dense
from keras.utils import np_utils
from keras.optimizers import SGD
import h5py
from build_model import build_model_train, build_... | mathDR/reading-text-in-the-wild | DICT2/TRAIN/train_dictnet.py | Python | gpl-3.0 | 4,487 |
# -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2013-10-24
# copyright ... | gem/oq-svir-qgis | svir/test/unit/test_irmt.py | Python | agpl-3.0 | 2,123 |
from __future__ import absolute_import
import logging
from typing import Any, Dict, List, Optional, Text
from argparse import ArgumentParser
from zerver.models import UserProfile
from django.utils.http import urlsafe_base64_encode
from django.utils.encoding import force_bytes
from django.contrib.auth.tokens import d... | jrowan/zulip | zerver/management/commands/send_password_reset_email.py | Python | apache-2.0 | 3,076 |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import patterns, url
from django.views.generic import RedirectView
from .models import Article, DateArticle
date_based_info_dict = {
'queryset': Article.objects.all(),
'date_field': 'date_created',
'month_format': '%m',... | rogerhu/django | tests/view_tests/generic_urls.py | Python | bsd-3-clause | 2,200 |
"""Support for Hangouts."""
import logging
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.helpers import dispatcher, intent
import homeassistant.helpers.config_validation as cv
# We need an import from .config_flow, withou... | fbradyirl/home-assistant | homeassistant/components/hangouts/__init__.py | Python | apache-2.0 | 4,555 |
#!/usr/bin/env python3
# written by sqall
# twitter: https://twitter.com/sqall01
# blog: https://h4des.org
# github: https://github.com/sqall01
#
# Licensed under the GNU Affero General Public License, version 3.
import sys
import os
import stat
from lib import ServerCommunication, ConnectionWatchdog, Receiver
from l... | sqall01/alertR | alertClientKodi/alertRclient.py | Python | agpl-3.0 | 11,209 |
"""
Shogun demo, based on PyQT Demo by Eli Bendersky
Christian Widmer
Soeren Sonnenburg
License: GPLv3
"""
import numpy
import sys, os, csv
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import matplotlib
from matplotlib.colorbar import make_axes, Colorbar
from matplotlib.backends.backend_qt4agg import FigureCa... | cfjhallgren/shogun | examples/undocumented/python/graphical/interactive_svm_demo.py | Python | gpl-3.0 | 12,586 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import threading, thread
import requests, re
import random
import xml.etree.ElementTree as etree
from Utils import *
import ArtworkUtils as artutils
import SkinShortcutsIntegration as skinshortcuts
class ListItemMonitor(threading.Thread):
event = None
exit = Fal... | Lunatixz/script.skin.helper.service | resources/lib/ListItemMonitor.py | Python | gpl-2.0 | 70,988 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'SubtitleLanguage.subtitles_fetched_count'
db.delete_column('videos_subtitlelanguage'... | ujdhesa/unisubs | apps/videos/migrations/0159_drop_old_count_columns.py | Python | agpl-3.0 | 37,934 |
__author__ = 'Keith Kikta'
__copyright__ = "Copyright 2015, EPM Junkie"
__license__ = "BSD"
__version__ = "1.0"
__maintainer__ = "Keith Kikta"
__email__ = "[email protected]"
__status__ = "Alpha"
import sys
import re
from getopt import getopt, GetoptError
def main(argv):
source = ''
maps = ''
delimiter = "... | newbish/pyEpmTools | bulkreplace.py | Python | bsd-2-clause | 2,260 |
import matplotlib.pyplot as plt
class PlotMP(object):
scripName="Default Scrip"
maxX=0
minX=0
maxY=0
minY=0
currentDay=0
ax=None
allTextObj=[]
dataForPlot={}
def __init__(self,scripName,currentDay,maxX,minX,maxY,minY):
self.maxX=maxX
self.minX=minX
self.m... | gullyy/auctionTheory | auctionTheory/src/graph/PlotMP.py | Python | mit | 1,983 |
from app.notify_client import _attach_current_user, NotifyAdminAPIClient
from app.notify_client.models import InvitedUser
class InviteApiClient(NotifyAdminAPIClient):
def __init__(self):
super().__init__("a" * 73, "b")
def init_app(self, app):
self.base_url = app.config['API_HOST_NAME']
... | gov-cjwaszczuk/notifications-admin | app/notify_client/invite_api_client.py | Python | mit | 2,123 |
ICON_PATH="/usr/share/pixmaps/xbmc/"
| samnazarko/osmc | package/mediacenter-eventclients-common-osmc/files/usr/share/pyshared/xbmc/defs.py | Python | gpl-2.0 | 37 |
SETTINGS = {
'ROOT_DIR': '',
} | weidwonder/OwnPyProfiler | own_py_profiler/settings.py | Python | mit | 34 |
#
# froide documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 15 21:11:35 2011.
#
# 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.
#
# All configuration values hav... | fin/froide | docs/conf.py | Python | mit | 7,616 |
# -*- coding=utf-8 -*-
import sys
import time
import logging
import os
sys.path.append(os.getcwd())
logging.basicConfig()
from hammer.sqlhelper import SqlHelper
db_config = {
'host': 'localhost',
'port': 3306,
'user': 'root',
'password': '123456',
'db': 'test',
}
def test_create_table():
c... | awolfly9/hammer | test/test.py | Python | mit | 2,505 |
import os
import sys
import time
from magnolia.utility import *
from magnolia.utility import LOG as L
from magnolia.script.kancolle import testcase_normal
class TestCase(testcase_normal.TestCase_Normal):
def __init__(self, *args, **kwargs):
super(TestCase, self).__init__(*args, **kwargs)
@classmethod... | setsulla/stir | project/magnolia/script/kancolle/leveling.py | Python | mit | 1,534 |
#!/usr/bin/python3
import sys
import os
import smtplib
import email
import markdown
import yaml
import jinja2
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from serverboards_aio import print
import serverboards_aio as serverboards
email_utils = email.utils
settings = {}
@serverb... | serverboards/serverboards | plugins/core-notifications/serverboards_email.py | Python | apache-2.0 | 6,092 |
import tempfile
from email.parser import Parser
from GnuPGInterface import GnuPG
class PGPMimeParser(Parser):
def parse_pgpmime(self, message):
sig_count, sig_parts, sig_alg = 0, [], 'SHA1'
enc_count, enc_parts, enc_ver = 0, [], None
for part in message.walk():
mimetype = part.get_content_type(... | micahflee/Mailpile | mailpile/pgpmime.py | Python | agpl-3.0 | 1,698 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-23 11:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('clinic', '0004_auto_20170823_0925'),
... | memclutter/clinic-crm | src/appointment/migrations/0001_initial.py | Python | bsd-2-clause | 1,296 |
#!/usr/bin/python
usage = """usage:
plab_assistant [--path_to_files=<filename>] [--username=<username>]
[--port=<number>] --path_to_nodes=<filename> [--ssh_key=<filename>] action
action = check, install, uninstall, gather_stats, get_logs (check attempts to add the
boot strap software to nodes that do not have it ye... | twchoi/tmp-brunet-deetoo | scripts/planetlab/plab_assistant.py | Python | gpl-2.0 | 8,540 |
import logging
from flask import Flask
from flask.ext.restful import Api, Resource, reqparse
from flask.ext.restful.representations.json import output_json
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
output_json.func_globals['settings'] = {'ensure_... | ericwhyne/api_stub | app.py | Python | mit | 1,857 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 - 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
... | ntt-sic/neutron | neutron/openstack/common/rpc/amqp.py | Python | apache-2.0 | 22,783 |
# pylint: skip-file
# flake8: noqa
def main():
'''
ansible oc module for registry
'''
module = AnsibleModule(
argument_spec=dict(
state=dict(default='present', type='str',
choices=['present', 'absent']),
debug=dict(default=False, type='bool'),
... | andrewklau/openshift-tools | openshift/installer/vendored/openshift-ansible-3.5.13/roles/lib_openshift/src/ansible/oc_adm_registry.py | Python | apache-2.0 | 1,674 |
# #######
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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
#
# Unles... | 01000101/aria-csar-extension | setup.py | Python | apache-2.0 | 923 |
import os
import sys
import string
import xml.etree.ElementTree as etree
from xml.etree.ElementTree import SubElement
from utils import _make_path_relative
from utils import xml_indent
fs_encoding = sys.getfilesystemencoding()
def _get_filetype(fn):
if fn.rfind('.c') != -1 or fn.rfind('.C') != -1 or fn.rfind('.c... | credosemi/rt-thread-openrisc | tools/keil.py | Python | gpl-2.0 | 8,278 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <[email protected]>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | antoyo/qutebrowser | qutebrowser/config/value.py | Python | gpl-3.0 | 3,318 |
from hashlib import md5, sha1
import cherrypy
from cherrypy._cpcompat import ntob
from cherrypy.lib import httpauth
from cherrypy.test import helper
class HTTPAuthTest(helper.CPWebCase):
@staticmethod
def setup_server():
class Root:
@cherrypy.expose
def index(self):
... | heytcass/homeassistant-config | deps/cherrypy/test/test_httpauth.py | Python | mit | 6,313 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
""" Celestial body calculations and corrections """
__author__ = "Andy Casey <[email protected]>"
# This code has been modified from legacy codes. Credits are chronologically
# attributable to: Sergey Koposov, Kochukho, Ku... | GALAHProject/fits-spectrum-format | convert/motions.py | Python | mit | 16,386 |
# 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 collections import defaultdict
import json
import os
import urlparse
from mach.config import ConfigSettings
from m... | cstipkovic/spidermonkey-research | python/mozbuild/mozbuild/codecoverage/chrome_map.py | Python | mpl-2.0 | 4,195 |
import os
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
def scandir(dir, files=[]):
for file in os.listdir(dir):
path = os.path.join(dir, file)
if os.path.isfile(path) and path.endswith(".pyx"):
files.app... | aurelienpierre/Image-Cases-Studies | setup.py | Python | gpl-3.0 | 2,163 |
'''apport package hook for udisks
(c) 2009 Canonical Ltd.
Author: Martin Pitt <[email protected]>
'''
import os
import os.path
import apport.hookutils
import dbus
UDISKS = 'org.freedesktop.UDisks'
def add_info(report):
apport.hookutils.attach_hardware(report)
user_rules = []
for f in os.listdir('/... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/apport/package-hooks/udisks.py | Python | gpl-3.0 | 1,236 |
# Copyright (C) 2013-2014 Computer Sciences 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 a... | ezbake/ezbake-configuration | api/python/lib/ezconfiguration/constants/EzBakePropertyConstants.py | Python | apache-2.0 | 24,922 |
# Modified by CNSL
# 1) including TDNN based char embedding
# 06/02/17
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be foun... | calee88/ParlAI | parlai/agents/drqa_msmarco/rnet_qp.py | Python | bsd-3-clause | 11,967 |
# -*- coding: utf-8 -*-
import scrapy
from aliexpresscoupons.items import AliexpressItem
import datetime
class CouponsSpider(scrapy.Spider):
name = "coupons"
allowed_domains = ["coupon.aliexpress.com"]
start_urls = (
'http://coupon.aliexpress.com/proengine/sellerCouponList.htm',
)
def par... | ils78/aliexpresscoupons | aliexpresscoupons/spiders/coupons.py | Python | mit | 2,516 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from colle... | kslundberg/pants | src/python/pants/goal/products.py | Python | apache-2.0 | 11,915 |
import RPi.GPIO as GPIO
import time
buzzer_pin = 27
notes = {
'B0' : 31,
'C1' : 33, 'CS1' : 35,
'D1' : 37, 'DS1' : 39,
'EB1' : 39,
'E1' : 41,
'F1' : 44, 'FS1' : 46,
'G1' : 49, 'GS1' : 52,
'A1' : 55, 'AS1' : 58,
'BB1' : 58,
'B1' : 62,
'C2' : 65, 'CS2' : 69,
'D2' : 73, 'DS2' : 78,
'EB2' : 78,
'E2' : 82,
... | lesscomplex/HomeSec | lock/buzz_anm.py | Python | agpl-3.0 | 2,986 |
"""
Counting sort is applicable when each input is known to belong to a particular
set, S, of possibilities. The algorithm runs in O(|S| + n) time and O(|S|)
memory where n is the length of the input. It works by creating an integer array
of size |S| and using the ith bin to count the occurrences of the ith member of
S... | rahulnadella/Sort_Algorithms | countingsort/countingsort.py | Python | bsd-2-clause | 1,805 |
__author__ = 'Jan Brennenstuhl'
__version__ = '0.1'
| jbspeakr/letterman.py | letterman/__init__.py | Python | mit | 52 |
import os
SECUREDROP_TARGET_PLATFORM = os.environ.get("SECUREDROP_TARGET_PLATFORM")
testinfra_hosts = [
"docker://{}-sd-sec-update".format(SECUREDROP_TARGET_PLATFORM)
]
def test_ensure_no_updates_avail(host):
"""
Test to make sure that there are no security-updates in the
base builder cont... | ehartsuyker/securedrop | molecule/builder-xenial/tests/test_security_updates.py | Python | agpl-3.0 | 1,022 |
#!/usr/bin/python
#===============================================================================
#
# conversion script to create a mbstestlib readable file containing test specifications
# out of an testset file in XML format
#
#===============================================================================
# Input c... | SIM-TU-Darmstadt/mbslib | dependencies/mbstestlib/src/testsetXML2intermediateConverter.py | Python | lgpl-3.0 | 9,479 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010-2012 Infracom & Eurotechnia ([email protected])
# This file is part of the Webcampak project.
# Webcampak 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 Fo... | Webcampak/v2.0 | src/bin/webcampak.py | Python | gpl-3.0 | 11,254 |
from django.contrib import admin
from .models import BlogPost
# Register your models here.
admin.site.register(BlogPost)
| KevinBacas/FuzzeyPot | FuzzeyPot/Blog/admin.py | Python | mit | 122 |
import sys
import os.path
import urllib2
import re
from pyquery import PyQuery as pq
import common
def getId(url):
arr = url.split("/")
id = arr[len(arr) - 2]
return id
def getSiteUrl(urlRequest, monitor, rcbUrl):
result = ""
print("REQUEST: {0}".format(urlRequest))
try:
req = urllib2.urlopen(urlRequest, t... | vietdh85/vh-utility | script/hyip_stop.py | Python | gpl-3.0 | 1,859 |
# coding=utf-8
"""html to jinja2首席挖洞官
将本目录/子目录下的html文件中使用到的 *静态文件* 的URL改为使用jinja2 + flask url_for渲染
href="css/base.css" -> href="{{ url_for("static", filename="css/base.css") }}"
挖洞前会在文件同目录做一个.bak后缀名的备份文件。
Usage:
$ cd my_project
$ python2 translate.py
"""
from __future__ import print_function
import re
im... | bllli/tsxyAssistant | app/templates/translate.py | Python | gpl-3.0 | 1,644 |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from ... | crowning-/dash | qa/rpc-tests/invalidblockrequest.py | Python | mit | 4,290 |
def ci():
return "ci"
| hallemaen/ci | ci/app.py | Python | mit | 28 |
# -*-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/joueur/commandes/bannir/__init__.py | Python | bsd-3-clause | 2,516 |
PROJECT_NAME = "sen"
LOG_FILE_NAME = "sen.debug.log"
FALLBACK_LOG_PATH = "/tmp/sen.debug.log"
ISO_DATETIME_PARSE_STRING = "%Y-%m-%dT%H:%M:%S.%f"
| TomasTomecek/sen | sen/constants.py | Python | mit | 146 |
# coding: utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)
import json
import logging
import boto3
import os
import sys
import time
# Path to modules needed to package local lambda function for upload
currentdir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os... | alanwill/aws-tailor | sam/functions/talr-entsupport/handler.py | Python | gpl-3.0 | 4,302 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RGit2r(RPackage):
"""Interface to the 'libgit2' library, which is a pure C implementation ... | iulian787/spack | var/spack/repos/builtin/packages/r-git2r/package.py | Python | lgpl-2.1 | 1,261 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | mbohlool/client-python | kubernetes/test/test_v1_object_meta.py | Python | apache-2.0 | 929 |
#!/usr/bin/env python
import os.path
import sys
import gspread
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
def read(filename):
return open(os.path.join(os.path.dirname(_... | finoptimal/gspread | setup.py | Python | mit | 1,460 |
"""
Google Maps Directions API methods to do things
related with network analysis
"""
from gasp.web import http_to_json
from . import select_api_key
from . import record_api_utilization
# ------------------------------ #
"""
Global Variables
"""
GOOGLE_GEOCODING_URL = 'https://maps.googleapis.com/maps/api/directions... | JoaquimPatriarca/senpy-for-gis | gasp/fromapi/glg/directions.py | Python | gpl-3.0 | 3,090 |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from .widget import *
default_app_config = 'leonardo.module.media.MediaConfig'
class Default(object):
optgroup = 'Media'
@property
def apps(self):
return [
'leonardo.module',
'le... | amboycharlie/Child-Friendly-LCMS | leonardo/module/media/__init__.py | Python | apache-2.0 | 2,222 |
#This is practice code which seeks to recognize digits from the MNIST dataset
#primarily through convolutional neural networks.
#The data set consists of tens of thousands of greyscale images of handwritten digits.
#This was used to create a submission to Kaggle.com, a platform
#for data science competitions. This part... | MichaelMKKang/Projects | Kaggle_Projects/DigitRecognizer.py | Python | mit | 10,079 |
import numpy as np
import pandas as pd
import pytest
from landlab import FieldError, RasterModelGrid
from landlab.components import COMPONENTS
_VALID_LOCS = {"grid", "node", "link", "patch", "corner", "face", "cell"}
_REQUIRED_ATTRS = {"doc", "mapping", "dtype", "intent", "optional", "units"}
_EXCLUDE_COMPONENTS = ... | landlab/landlab | tests/components/test_components.py | Python | mit | 5,319 |
import py, pytest
from _pytest.config import Conftest
def pytest_generate_tests(metafunc):
if "basedir" in metafunc.fixturenames:
metafunc.addcall(param="global")
metafunc.addcall(param="inpackage")
def pytest_funcarg__basedir(request):
def basedirmaker(request):
basedir = d = request.... | geraldoandradee/pytest | testing/test_conftest.py | Python | mit | 8,268 |
# -*- 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-dataplex | samples/generated_samples/dataplex_v1_generated_content_service_delete_content_sync.py | Python | apache-2.0 | 1,392 |
# coding: utf-8
# Copyright 2014 The Oppia 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 requir... | zgchizi/oppia-uc | core/controllers/editor.py | Python | apache-2.0 | 37,959 |
# XXX Final exam problem 4. Work here.
posts.update({'permalink':permalink}, {'$inc': {'comments.' + comment_ordinal + '.num_likes': 1}}); | hemmerling/nosql-mongodb2013 | src/m101j/final/final-4/hemmerling_final4.py | Python | apache-2.0 | 139 |
"""
A test spanning all the capabilities of all the serializers.
This class sets up a model for each model field type
(except for image types, because of the PIL dependency).
"""
from django.db import models
from django.contrib.contenttypes.models import ContentType
# The following classes are for testing basic dat... | jamslevy/gsoc | thirdparty/google_appengine/lib/django/tests/regressiontests/serializers_regress/models.py | Python | apache-2.0 | 5,334 |
#!/usr/bin/env python
#
# Copyright 2007 Doug Hellmann.
#
#
# 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 all
# copies and tha... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/pprint/pprint_depth.py | Python | gpl-3.0 | 1,202 |
import numpy as np
import amnet
import z3
from numpy.linalg import norm
import sys
import unittest
import itertools
VISUALIZE = True # output graphviz drawings
if VISUALIZE:
import amnet.vis
class TestSmt(unittest.TestCase):
@classmethod
def setUpClass(cls):
print 'Setting up test floats.'
... | ipapusha/amnet | tests/test_smt.py | Python | bsd-3-clause | 32,730 |
import base64
from django.test import TestCase
from django.test.utils import override_settings
import json
import re
from student.tests.factories import UserFactory
from unittest import SkipTest
from user_api.models import UserPreference
from user_api.tests.factories import UserPreferenceFactory
from django_comment_co... | geekaia/edx-platform | common/djangoapps/user_api/tests/test_views.py | Python | agpl-3.0 | 20,805 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2020 Ryan Roden-Corrent (rcorre) <[email protected]>
#
# This file is part of qutebrowser.
#
# qutebrowser 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... | t-wissmann/qutebrowser | tests/unit/misc/test_keyhints.py | Python | gpl-3.0 | 7,603 |
# -*- coding: utf-8 -*-
#
# Copyright © 2016 Mathieu Duponchelle <[email protected]>
# Copyright © 2016 Collabora Ltd
#
# 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; eit... | thiblahute/hotdoc | hotdoc/extensions/__init__.py | Python | lgpl-2.1 | 2,294 |
# -*- coding: utf-8 -*-
#
# File: src/webframe/management/commands/pref.py
# Date: 2020-04-22 21:35
# Author: Kenson Man <[email protected]>
# Desc: Import / Create / Update / Delete preference
#
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.management.base import B... | kensonman/webframe | management/commands/pref.py | Python | apache-2.0 | 18,742 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) Camptocamp SA
# Author: Arnaud WÃŒst
#
#
# This file is part of the c2c_report_tools module.
#
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the w... | VitalPet/c2c-rd-addons | c2c_reporting_tools_chricar/c2c_helper.py | Python | agpl-3.0 | 8,306 |
"""Helper methods for classification."""
import numpy
from gewittergefahr.gg_utils import error_checking
def classification_cutoffs_to_ranges(class_cutoffs, non_negative_only=True):
"""Converts classification cutoffs to min/max for each class.
C = number of classes
c = C - 1 = number of cutoffs
:pa... | thunderhoser/GewitterGefahr | gewittergefahr/gg_utils/classification_utils.py | Python | mit | 3,206 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.