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 |
|---|---|---|---|---|---|
#!/usr/bin/python198
# -*- coding: UTF-8 -*-
import sys
import datetime
from pyelasticsearch import ElasticSearch
from pyelasticsearch import bulk_chunks
def main(argv):
index = argv[1]
doc_type = 'log'
url = []
urls = argv[2].strip().split(',')
for u in urls:
url.append(u)
es = Elast... | JThink/SkyEye | skyeye-collector/skyeye-collector-metrics/src/main/resources/shell/create-index.py | Python | gpl-3.0 | 2,293 |
""" Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,i... | amrdraz/brython | www/src/Lib/encodings/iso8859_1.py | Python | bsd-3-clause | 13,483 |
from subprocess import Popen, PIPE
def is_class(file):
return file.endswith(".class") and not file.startswith("META-INF")
def modified_paths(patch):
p = Popen(["jar", "-tf", patch], stdout=PIPE)
output, _ = p.communicate()
return filter(is_class, [file.decode() for file in output.split(b"\n")])
def ... | alepulver/changesets | patch_analyzer/patch_utils.py | Python | mit | 562 |
#
# 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... | Acehaidrey/incubator-airflow | airflow/providers/google/cloud/utils/mlengine_prediction_summary.py | Python | apache-2.0 | 7,586 |
import scrapy
class AuthorSpider(scrapy.Spider):
name = 'know'
start_urls = ['http://www.knowafest.com/college-fests/upcomingfests']
def parse(self, response):
# follow links to author pages
for href in response.css('.author+a::attr(href)').extract():
yield scrapy.Request(res... | Apoorv13/fest_crawl | scrape/know/know/spiders/scrape.py | Python | mit | 1,013 |
import cv2
import numpy as np
from tree import ImageTree
# These functions take care of the tree formation process, finding the image couples that have the most in common
# Finds the best links between images
def solve(array, index=0):
shape = array.shape
edge_array = np.full(shape, False)
cost_array = np.empty(s... | DavidResin/aps-aalto | stitch/linker.py | Python | gpl-3.0 | 1,995 |
# coding: utf-8
from __future__ import unicode_literals
from django.db import models
from djangosphinx.models import SphinxSearch
# Create your models here.
__all__ = ['Related', 'M2M', 'Search']
class Related(models.Model):
name = models.CharField(max_length=10)
def __unicode__(self):
return self.n... | Yuego/django-sphinx | testsphinx/testsphinx/testapp/models.py | Python | bsd-3-clause | 2,080 |
import os
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from PyQt5.QtCore import QSortFilterProxyModel
from PyQt5.QtGui import QImage, QPixmap, QIcon
from PyQt5.QtWidgets import (QMainWindow, QApplication, QVBoxLayout, QLabel,
QWidget, QAc... | esevlogiev/FrontDesk-System | gui/main.py | Python | gpl-3.0 | 13,299 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 cagayakemiracl All Rights Reserved.
# $Mail: <cagayakemiracl@gmail.com>
import random
from copy import deepcopy
from .group import Group
from .children import Children
class Parents(Group):
def mate(self):
"""
親集団から偶数奇数でペアを作り親を選択
ペアで交叉をして子を2... | cagayakemiracl/ec | ec/director/manager/factory/material/base/parents.py | Python | gpl-3.0 | 630 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-17 17:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('attendance', '0007_auto_20160417_1656'),
]
operations = [
migrations.RenameModel(
... | Tomik292/Hodoor | attendance/migrations/0008_auto_20160417_1703.py | Python | gpl-3.0 | 392 |
from nbody_graph_search import Ugraph
# To find 3-body "angle" interactions, we would use this subgraph:
#
#
# *---*---* => 1st bond connects atoms 0 and 1
# 0 1 2 2nd bond connects atoms 1 and 2
#
bond_pattern = Ugraph([(0,1), (1,2)])
# (Ugra... | ckloss/LIGGGHTS-PUBLIC | tools/moltemplate/src/nbody_Angles.py | Python | gpl-2.0 | 1,679 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe import _
from erpnext.accounts.utils import validate_expense_against_budget
class StockAc... | gangadhar-kadam/verve_test_erp | erpnext/accounts/general_ledger.py | Python | agpl-3.0 | 4,646 |
# -*- coding: utf-8 -*-
# $Id: wuihlpgraph.py $
"""
Test Manager Web-UI - Graph Helpers.
"""
__copyright__ = \
"""
Copyright (C) 2012-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and... | miguelinux/vbox | src/VBox/ValidationKit/testmanager/webui/wuihlpgraph.py | Python | gpl-2.0 | 4,309 |
import _plotly_utils.basevalidators
class SeparatethousandsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="separatethousands", parent_name="volume.colorbar", **kwargs
):
super(SeparatethousandsValidator, self).__init__(
plotly_name=plotly_... | plotly/python-api | packages/python/plotly/plotly/validators/volume/colorbar/_separatethousands.py | Python | mit | 495 |
from django.http import Http404
from django.shortcuts import render
from . import models
def index(request):
# Generate counts of some of the main objects
num_projects = models.Project.objects.all().count()
num_tasks = models.Tasks.objects.all().count()
num_fundings = models.Fundings.objects.all().co... | amexperts/bounty | projects/views.py | Python | gpl-3.0 | 1,079 |
#!/usr/bin/env python3
import rospy
from geometry_msgs.msg import Twist
GUTTER_VAL = 0.01
class MockPublisher(object):
def publish(self, *args, **kwargs):
pass
def MockFunc(*args, **kwargs):
pass
# every 10ms:
# check if axis is within threshold of previous sample
# if within threshold, incremen... | EndPointCorp/lg_ros_nodes | spacenav_wrapper/src/spacenav_wrapper/space_wrapper.py | Python | apache-2.0 | 5,226 |
""" Testing hrf module
"""
from __future__ import absolute_import
from os.path import dirname, join as pjoin
import numpy as np
from scipy.stats import gamma
import scipy.io as sio
from ..hrf import (
gamma_params,
gamma_expr,
lambdify_t,
spm_hrf_compat,
spmt,
dspmt,
ddspmt,
)
from ... | alexis-roche/nipy | nipy/modalities/fmri/tests/test_hrf.py | Python | bsd-3-clause | 3,668 |
# -*- coding: utf-8 -*-
"""
|oauth1| Providers
--------------------
Providers which implement the |oauth1|_ protocol.
.. autosummary::
OAuth1
Bitbucket
Flickr
Meetup
Plurk
Twitter
Tumblr
UbuntuOne
Vimeo
Xero
Xing
Yahoo
"""
import abc
import binascii
import datetime
i... | authomatic/authomatic | authomatic/providers/oauth1.py | Python | mit | 38,857 |
# -*- coding: utf-8 -*-
import unittest
from pynes.compiler import lexical, syntax, semantic
class InxTest(unittest.TestCase):
def test_inx_sngl(self):
tokens = list(lexical('INX'))
self.assertEquals(1, len(tokens))
self.assertEquals('T_INSTRUCTION', tokens[0]['type'])
ast = syn... | shekkbuilder/pyNES | pynes/tests/inx_test.py | Python | bsd-3-clause | 495 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""
Benchmarks stages of operation of the function
:func:`iris.experimental.ugrid.utils.recombine_submeshes`.
Where possible b... | SciTools/iris | benchmarks/benchmarks/regions_combine.py | Python | lgpl-3.0 | 9,696 |
################################################################################
#
# This program is part of the HPEVAMon Zenpack for Zenoss.
# Copyright (C) 2010 Egor Puzanov.
#
# This program can be used under the GNU General Public License version 2
# You can find full information here: http://www.zenoss.com/oss
#
#... | anksp21/Community-Zenpacks | ZenPacks.community.HPEVAMon/ZenPacks/community/HPEVAMon/HPEVAStorageDiskEnclosure.py | Python | gpl-2.0 | 5,528 |
import zeit.cms.admin.interfaces
import zeit.cms.content.interfaces
import zeit.cms.interfaces
import zeit.cms.workflow.interfaces
import zope.component
import zope.interface
class AdjustSemanticPublish(object):
zope.component.adapts(zeit.cms.interfaces.ICMSContent)
zope.interface.implements(zeit.cms.admin.i... | ZeitOnline/zeit.cms | src/zeit/cms/admin/semantic.py | Python | bsd-3-clause | 1,757 |
# -*- coding: utf-8 -*-
"""
Created on Thu May 24 10:01:14 2018
@author: huang
"""
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import parseaddr, formataddr
import smtplib
import time
impor... | Svolcano/python_exercise | dianhua/endday_batch/sid_info_anly_batch.py | Python | mit | 2,068 |
# Copyright 2013 Dean Gardiner <gardiner91@gmail.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 a... | coderb0t/CouchPotatoServer | libs/caper/result.py | Python | gpl-3.0 | 5,904 |
from django.db import models
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
class Photo(models.Model):
author = models.ForeignKey(User, related_name='photos')
title = models.CharField(max_length=127, blank=True)
datetime = models.DateTimeField(auto_now_add=True... | cjworld/WeddingAssist | parties/models.py | Python | mit | 2,468 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import db
from datetime import datetime
class User(db.Model):
__table_args__ = {
'mysql_engine': 'InnoDB',
'mysql_charset': 'utf8mb4'
}
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
openid = db.Column(db.String(3... | 15klli/WeChat-Clone | main/models/user.py | Python | mit | 1,617 |
#!/usr/bin/env python
"""
Copyright (C) 2012 Legoktm
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, publi... | legoktm/pywikipedia-scripts | file_has_rationale_yes.py | Python | mit | 4,350 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... | redmeros/Lean | Algorithm.Python/MACDTrendAlgorithm.py | Python | apache-2.0 | 3,115 |
from outsourcer import Code
from . import utils
from .base import Expression
from .constants import BREAK, POS, RESULT, STATUS
class Sep(Expression):
num_blocks = 2
def __init__(
self,
expr,
separator,
discard_separators=True,
allow_trailer=False,
... | jvs/sourcer | sourcer/expressions/sep.py | Python | mit | 2,062 |
import datetime
import time
import logging
import _thread
logging.basicConfig(level=logging.INFO, format=' %(asctime)s - %(levelname)s - %(message)s')
from opcode.library import snmpget
from opcode.snmp_query import *
while True:
switch_core(5) #
firewall_dc(5)
firewall_campus(5)
firewall_academic(5)
... | harrisjnu/Autonoe | __main__.py | Python | apache-2.0 | 336 |
#!/usr/bin/env python
import sys
if sys.version_info < (2, 4) or sys.version_info >= (3,):
sys.stderr.write('ERROR: requires Python versions >= 2.4 and < 3.0\n')
sys.exit(1)
from distutils.core import setup
setup(
# GENERAL INFO
name = 'eveapi',
version = '1.2.6',
description = 'Python libr... | fabianfreyer/eveapi | setup.py | Python | mit | 1,064 |
#!/usr/bin/python
#
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import Queue
import os
import shutil
import tempfile
import threading
import common_util
import log_util
class Downloader(log_u... | marineam/coreos-dev-util | downloader.py | Python | bsd-3-clause | 18,401 |
#!/usr/bin/env python
# -*- 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,... | RyanSkraba/beam | sdks/python/apache_beam/io/gcp/bigquery_write_it_test.py | Python | apache-2.0 | 10,496 |
#!/usr/bin/python
# coding: utf-8 -*-
# (c) 2017, Wayne Witzel III <wayne@riotousliving.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1... | alexlo03/ansible | lib/ansible/modules/web_infrastructure/ansible_tower/tower_job_launch.py | Python | gpl-3.0 | 4,034 |
#!/usr/bin/python
########################################################################## RAD4SNPs:##############################################################################
# A set of Python scripts to select and validate independent SNPs markers from a list of read files #
#################################... | glassalle/Rad4Snps | RAD4SNPs_Main.py | Python | gpl-3.0 | 12,997 |
"""this is python equivalent of ./Wrapping/Tcl/vtktesting/backdrop.tcl
This script is used while running python tests translated from Tcl."""
import vtk
basePlane = None
baseMapper = None
base = None
backPlane = None
backMapper = None
back = None
leftPlane = None
leftMapper = None
left = None
def BuildBackdrop (mi... | b3c/VTK-5.8 | Utilities/vtkTclTest2Py/backdrop.py | Python | bsd-3-clause | 1,885 |
#!/usr/bin/python
#-*- coding: UTF-8 -*-
#Carlos Rodriguez Garcia PTAVI Practica 3 Karaoke.
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
import smallsmilhandler
import sys
import os
tagsrc = ['img', 'audio', 'textstream']
class KaraokeLocal(ContentHandler):
def __init__(self, fich... | crodriguezgarci/ptavi-p3 | karaoke.py | Python | gpl-2.0 | 1,524 |
'''
To run the script, run the following command the same direcotry.
git clone https://github.com/bukun/pycsw_helper.git
'''
import os
import uuid
import html2text
from tornado.escape import xhtml_unescape
from pycsw_helper.csw_helper import MRecords
from torcms.model.post_model import MPost
mrec = MRecords()
... | bukun/TorCMS | helper_scripts/script_export_into_pycsw.py | Python | mit | 3,309 |
from __future__ import print_function
import os
import subprocess
from distutils.command.build import build as distutils_build #pylint: disable=no-name-in-module
from setuptools import setup, find_packages, Command as SetupToolsCommand
VERSION = '0.1.dev0'
# Dataflow workers always download the requirements file to
#... | kubeflow/examples | code_search/src/setup.py | Python | apache-2.0 | 2,536 |
import numpy as np
import os
from astropy.convolution import convolve, convolve_fft, Gaussian1DKernel
def suppress_frange(data, frange, convinterp=True, width=2,
convolve_with_fft=False, kernscale=12):
"""
Given a spectrum, interpolate across a specified frequency range.
Frequency is in... | adamginsburg/APEX_CMZ_H2CO | shfi_otf_pipeline/fourier_suppression.py | Python | bsd-3-clause | 2,991 |
# Copyright 2018 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 applicable law or a... | google/loaner | loaner/web_app/backend/handlers/cron/run_shelf_audit_events_test.py | Python | apache-2.0 | 6,937 |
############################################################################
# Copyright (C) 2005 by Reithinger GmbH
# mreithinger@web.de
#
# This file is part of faces.
#
# faces is free software; you can redistribute it and/or modify
# ... | diogocs1/comps | web/addons/resource/faces/timescale.py | Python | apache-2.0 | 3,902 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from corehq.sql_db.operations import HqRunSQL
class Migration(migrations.Migration):
dependencies = [
('form_processor', '0059_remove_ledgervalue_location_id'),
]
operations = [
# T... | qedsoftware/commcare-hq | corehq/form_processor/migrations/0060_convert_case_ids_to_foreign_keys.py | Python | bsd-3-clause | 2,877 |
#!/usr/bin/python
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | panoptes/environmental-analysis-system | historical-data-fixer/schema_extractor.py | Python | mit | 3,559 |
import serial
from threading import Thread
from menu import Menu
from time import sleep
import settings as s
import pygame
from pygame import *
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=.025)
current_mark = None
def worker():
global current_mark
while True:
read_serial = ser.readline().strip... | DrewMcCarthy/dartboard | scenemanager.py | Python | apache-2.0 | 1,324 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.contrib.auth.models import AnonymousUser... | shoopio/shoop | shuup_tests/gdpr/test_front_views.py | Python | agpl-3.0 | 5,671 |
# Copyright 2017 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... | chemelnucfin/tensorflow | tensorflow/examples/label_image/label_image.py | Python | apache-2.0 | 4,727 |
import jwt
import json
import urllib2
from functools import wraps
from flask import request
from app.handler.dbHelper import DBHelper
from app.config import DOP_API_RPT
from app.handler.error_handler import CustomError, PermissionDenied, NotAuthorized
__author__ = 'Xiaoxiao.Xiong'
def validate_token(auth):
"""... | dhrproject/mydatasource | DataSource/app/auth.py | Python | mit | 2,865 |
class Solution(object):
def isMatch(self, s, p):
"""
:type s: str
:type p: str
:rtype: bool
"""
if not s or not p:
return False
ls, lp = len(s), len(p)
mem = [[False] * (lp+1) for _ in range(ls+1)]
mem[0][0] = True
... | dichen001/Go4Jobs | JackChen/Google/10. Regular Expression Matchi.py | Python | gpl-3.0 | 1,031 |
#!/usr/bin/python
# (c) 2017 Jim Hawkins. MIT licensed, see https://opensource.org/licenses/MIT
# Part of Blender Driver, see https://github.com/sjjhsjjh/blender-driver
"""Python module for window and screen geometry.
This file can only be used as a module."""
# Exit if run other than as a module.
if __name__ == '__ma... | sjjhsjjh/blender-driver | scripts/windowgeometry.py | Python | mit | 5,760 |
#!/usr/bin/env python
#_*_coding:utf-8_*_
logpath = '/server/www_access_20140823.log'
web_status = {}
f = open(logpath, 'r')
for i in f:
flist = i.split()
web_status[(flist[0], flist[6], flist[8])] = web_status.get((flist[0], flist[6], flist[8]),0) + 1
Ngx_list = web_status.items()
Ngx_dic = sorted(Ngx_lis... | 51reboot/actual_09_homework | 03/qicheng/web_status.py | Python | mit | 676 |
# Copyright 2013 Nebula 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... | BjoernT/python-openstackclient | openstackclient/object/v1/container.py | Python | apache-2.0 | 7,719 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Mathias Brodala
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is dist... | virtuald/exaile | xl/formatter.py | Python | gpl-2.0 | 27,825 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Magneticoin-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./";
... | alttcoin/mgc | share/qt/clean_mac_info_plist.py | Python | mit | 902 |
DESCRIPTION = "Industry attack graph analysis."
import networkx as nx
import copy
import matplotlib.pyplot as plt
from prettytable import PrettyTable
import csv
MITIGATIONS_FILE = "LOCATION TO STORE CSV FILE OF MITIGATIONS AND PATH LENGTH"
# Set locations
LOCATION = "~/Documents/Development/VERISAG/"
FILTERS = "~/Do... | vz-risk/veris_scripts | atk_graph.py | Python | apache-2.0 | 4,305 |
# coding=utf-8
"""
Jenkins statistics reports generator
Run it in command line after adjust configuration on jenkins_statistics_config.py file
Generates a report in following format:
---------------------------------------------------------------------------------------
------------------------------- JOBS EXECUTADO... | BrunoCaimar/JenkinsStatistics | jenkins_statistics_reports.py | Python | mit | 5,891 |
###############################################################################
# #
# 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 ... | dparks1134/UniteM | unitem/bin.py | Python | gpl-3.0 | 11,713 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import fileinput
import pdb
import sys
import traceback
from itertools import permutations
def solve(paths):
cities = set()
distances = dict()
for start, end, distance in paths:
cities.add(start)
cities.add(end)
distances.setdefault(st... | BrendanLeber/adventofcode | 2015/09-single_night/solver.py | Python | mit | 993 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
dirs = ('ITK320BIN', 'VTKBIN', 'CSwig320BIN')
exts = ('*.obj', '*.ilk', '*.ncb', '*.suo')
import os
import fnmatch
for dir in dirs:
for path, subdirs, files in os.walk(dir):
# files.extend(subdirs)
for name in files:
for ext in exts:
... | rboman/progs | sandbox/filemgr/cleanOBJs.py | Python | apache-2.0 | 472 |
#!/usr/bin/env python
# Find PI to the Nth Digit - Enter a number and have the program generate PI up
# to that many decimal places. Keep a limit to how far the program will go.
import math
from decimal import *
MY_PROMPT = lambda: raw_input("> ")
error = "Please try again with a positive number, less than 48"
messa... | wreckage/py_projects | Numbers/pi.py | Python | bsd-2-clause | 1,440 |
"""The module contains page parsers and an implementation of a terms extractor.
"""
from collections import deque, namedtuple
from hashlib import sha1
import logging
import pathlib
import re
import sys
from urllib.parse import urlparse, parse_qs, urlencode
import lxml.html as etree
from jobtechs.common import iter_... | newtover/process_jobs | jobtechs/parser.py | Python | mit | 19,797 |
#!/usr/bin/env python
# coding=utf-8
from scrapy.spiders import Spider
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor as link
from scrapy.http import Request, FormRequest
from scrapy.selector import Selector
from illustrious.items import ProblemItem, SolutionItem, AccountIt... | Coderhypo/makinami | illustrious/spiders/poj.py | Python | mit | 12,789 |
from flask import Flask, redirect, url_for, request, Response, render_template
import wikipedia
app = Flask(__name__)
@app.route('/')
def student():
return render_template('index.html')
@app.route('/search/<name>')
def success(message):
return '%s' % message
@app.route('/search',methods = ['POST', 'GET'])
def... | csbenk/flash-experiment | test.py | Python | apache-2.0 | 3,565 |
from PIL import Image, ImageFilter
import sys
try:
original = Image.open("testimagelarge.png").convert("L").rotate(90)
except:
print "Unable to load image"
sys.exit(1)
print "The size of the Image is: "
print(original.format, original.size, original.mode)
output = open("testimagelarge.raw", "wb")
for y i... | the-louie/kobo-yrno | server_code/png2raw.py | Python | bsd-3-clause | 990 |
#!/usr/bin/env python
from webdriver_testing.pages.site_pages.teams import ATeamPage
import time
class TasksTab(ATeamPage):
"""Actions for the Videos tab of a Team Page.
"""
_URL = 'teams/%s/tasks/'
_SEARCH = 'form.search input[name="q"]'
_SEARCHING_INDICATOR = "img.placeholder"
_NO_RESULTS = ... | ReachingOut/unisubs | apps/webdriver_testing/pages/site_pages/teams/tasks_tab.py | Python | agpl-3.0 | 4,256 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | wkentaro/wstool | test/local/test_config_yaml.py | Python | bsd-3-clause | 15,856 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from frappe import _
from erpnext.controllers.trends import get_columns, get_data
def execute(filters=None):
if not filters: filters ={}
data = []
conditions = get_columns(filters, "Pur... | mhbu50/erpnext | erpnext/buying/report/purchase_order_trends/purchase_order_trends.py | Python | gpl-3.0 | 1,445 |
import functools
from pathlib import Path
import graphviz as gv
from waflib import Utils
graph = functools.partial(gv.Graph, format="png")
digraph = functools.partial(gv.Digraph, format="png")
styles = {
"graph": {
"label": "DAG of Project",
"fontsize": "48",
"fontcolor": "white",
... | hmgaudecker/econ-project-templates | {{cookiecutter.project_slug}}/src_julia/final/project_dependency_graph.py | Python | bsd-3-clause | 2,492 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing M2M table for field locus on 'MLSTDataSet'
db.delete_table('mlst_mlstdataset_locus')
# A... | indexofire/gork | src/gork/application/mlst/migrations/0002_auto__add_field_mlstlocus_dataset.py | Python | mit | 10,542 |
import logging
import os
import sys
from threading import Thread
from i3pystatus.core import io, util
from i3pystatus.core.exceptions import ConfigError
from i3pystatus.core.imputil import ClassFinder
from i3pystatus.core.modules import Module
DEFAULT_LOG_FORMAT = '%(asctime)s [%(levelname)-8s][%(name)s %(lineno)d] %... | richese/i3pystatus | i3pystatus/core/__init__.py | Python | mit | 4,792 |
import logging
import ssl
from typing import List # pylint: disable=unused-import
import aiohttp
import certifi
import trio_asyncio
from aiohttp.http_exceptions import HttpProcessingError
from .base import BufferedFree, Limit, Sink, Source
logger = logging.getLogger(__name__)
class AiohttpClientSessionMixin:
... | syncrypt/client | syncrypt/pipes/http.py | Python | gpl-3.0 | 5,339 |
# Copyright 2016 Autodesk 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... | tkzeng/molecular-design-toolkit | moldesign/exceptions.py | Python | apache-2.0 | 1,118 |
from app import db, bcrypt
from app.models.base import Base
class User(Base):
__tablename__ = 'user_tbl'
id = db.Column(db.Integer, db.ForeignKey('base_tbl.id'), primary_key=True)
__mapper_args__ = {'polymorphic_identity': 'user'}
username = db.Column(db.String(), unique=True, nullable=False)
firstname = db.Colu... | omarayad1/cantkeepup | app/models/user.py | Python | mit | 1,018 |
"""This module stores connector classes, like Contact.
"""
from . import base_classes
class SurfaceInteraction(base_classes.Idobj):
"""Makes a surface interaction object.
Args:
int_type (str): interaction type
* 'EXPONENTIAL'
* 'LINEAR'
*args: following arguments
... | spacether/pycalculix | pycalculix/connectors.py | Python | apache-2.0 | 2,699 |
# -*- coding: iso-8859-15 -*-
# -*- Mode: Python; py-ident-offset: 4 -*-
# vim:ts=4:sw=4:et
# Copyright (c) M�rio Morgado
#
# 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 retai... | yasharmaster/scancode-toolkit | src/packagedcode/pyrpm/rpm.py | Python | apache-2.0 | 10,566 |
# coding=utf-8
# Copyright 2020 The HuggingFace Team. 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... | huggingface/transformers | tests/mobilebert/test_modeling_mobilebert.py | Python | apache-2.0 | 15,383 |
#
# (c) 2017 Red Hat Inc.
#
# 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 d... | mheap/ansible | lib/ansible/plugins/netconf/junos.py | Python | gpl-3.0 | 5,602 |
# _*_ coding: utf-8 _*_
# This file determines how articles are accessed.
# You may also want to examine the Article class in emissary/models.py
from emissary import db
from flask import request
from flask.ext import restful
from sqlalchemy import desc, and_
from emissary.models import Article
from emissary.resources.a... | LukeB42/Emissary | emissary/resources/articles.py | Python | mit | 5,401 |
#!/usr/bin/python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
import os
from setuptools import setup, find_packages
# just in case setup.py is launched from elsewhere that the containing directory
originalDir = os.getcwd()
os.chdir(os.path.dirname(os.path.abspath(__file__)))
try:
setup(
name = "list... | benhoff/plugins | setup.py | Python | gpl-3.0 | 844 |
# Copyright (c) 2022 PaddlePaddle 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 ap... | luotao1/Paddle | python/paddle/fluid/tests/unittests/distributed_passes/test_dist_fuse_bn_add_act_pass.py | Python | apache-2.0 | 3,476 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# How to merge file on server side using Python's Flask
# A demo for Antoine
# Copyright (C) 2015 Seydou Dia
# 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 F... | sdia/Antoine_App | app.py | Python | gpl-2.0 | 1,978 |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Weibo(models.Model):
'''所有微博'''
wb_type_choices = (
(0,'new'),
(1,'forward'),
(2,'collect'),
)
wb_type = models.IntegerField(choices=wb_type_choices,default=0)
forward_... | oldboys1/Weibo | web/models.py | Python | gpl-3.0 | 2,614 |
from flask import Flask
from config import config
def create_app(environment):
# configure flask webapp + assign static folder
app = Flask(__name__, static_url_path="", static_folder="../resources/static", template_folder="../resources/templates")
app.config.from_object(config[environment])
# import... | spasal/dreamdeep | app/__init__.py | Python | mit | 785 |
from django.contrib import admin
from .models import UserProfile
# Register your models here.
admin.site.register(UserProfile) | geminateCoder/Gemini-Project | rp_grounds/userprofile/admin.py | Python | gpl-3.0 | 128 |
# -*- coding: utf-8 -*-
from django.http import HttpResponseRedirect
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth import login as user_login, logout as user_logout, authenticate
from django.shortcuts import render, redirect
from django.utils.crypto import get_r... | Lisaveta-K/lisaveta-k.github.io | _site/tomat/apps/users/views/auth.py | Python | mit | 4,942 |
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
def get_type():
return "BINARY"
def get_sub_type():
return "TOOLS"
def get_desc():
return "ZEUS generic client (command line interface to introspect services)"
def get_licence():
return "MPL-2"
def get_compagny_type():
return "com"
d... | atria-soft/zeus | tools/cli/lutin_zeus-cli.py | Python | apache-2.0 | 649 |
from .models import Tweets
from rest_framework import serializers
class TweetsSerializer(serializers.ModelSerializer):
created_at = serializers.DateTimeField(format='%Y-%m-%d %H:%M:%S', input_formats='%Y-%m-%d %H:%M:%S')
class Meta:
model = Tweets
fields = ('user', 'user_url', 'user_image',
... | jhbarnett/Twitter_Playoffs | server/twitter/serializers.py | Python | mit | 413 |
#generate all the plots for the market project
from optparse import OptionParser
import matplotlib.pyplot as plt
#import cartopy.crs as ccrs
import matplotlib as mpl
#import cartopy.io.shapereader as shpreader
import numpy as np
__author__ = 'mattdyer'
# add labels to a plot
# @param points The plot object
# @param ... | dyermd/legos | marketing/hyperfine_marketing_plots.py | Python | gpl-2.0 | 38,333 |
# encoding=utf-8
from gi.repository import Gtk
from .i18n import _
class AboutDialog(Gtk.AboutDialog):
def __init__(self, parent):
super(AboutDialog, self).__init__(title=_('About'), parent=parent)
self.set_modal(True)
self.set_program_name('Ydict')
self.set_authors(['Wiky L<wiii... | wiiiky/ydict | pydict/about.py | Python | gpl-3.0 | 743 |
from local import *
| pmav99/django-template | website/app/config/settings/test.py | Python | mit | 20 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | google/pwlfit | pwlfit/test_util.py | Python | apache-2.0 | 1,540 |
# -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse_lazy
DASHBOARD_URL = reverse_lazy('dashboard:dashboard')
LOGIN_URL = reverse_lazy('project_manager_auth:login')
LOGOUT_URL = reverse_lazy('project_manager_auth:logout')
| alexander-ae/django-project-manager | project_manager/project_manager_auth/constants.py | Python | gpl-3.0 | 240 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import traceback
from loguru import logger
# logger = logging.getLogger()
import datetime
import os
import os.path as op
from io3d.network import download_file
# def write_update_info_in_file():
# import misc
# now = datetime.datetime.now()
def ... | mjirik/lisa | lisa/update_stable.py | Python | bsd-3-clause | 6,953 |
# coding=utf8
import audiogen
from itertools import izip_longest
unit = audiogen.util.constant(1)
def setup_mux():
return audiogen.util.mixer((iter(range(10)),), ((unit,),(unit,)))
def test_mux_output_channels():
output = setup_mux()
assert len(output) == 2
def test_mux_duplicated_content():
output = setup_mux... | casebeer/audiogen | test/test.py | Python | bsd-2-clause | 640 |
import tkinter as tk
_1080P = (1920, 1080)
_2K = (2560, 1440)
_4K = (3840, 2160)
def get_center_geometry(p_root: tk.Tk):
"""根据屏幕分辨率确定一个合适的窗口大小,并在屏幕中心居中"""
screen_resolution = p_root.winfo_screenwidth(), p_root.winfo_screenheight()
if screen_resolution[1] == _1080P[1]:
window_resolution = (800, 6... | shifvb/hash_photos | _gui/get_geometry.py | Python | apache-2.0 | 1,124 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 AVSystem <avsystem@avsystem.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 requi... | dextero/Anjay | test/integration/framework/nsh-lwm2m/pymbedtls/setup.py | Python | apache-2.0 | 1,764 |
from ..exceptions import SerializationError,DeserializationError
from ..atomic import Atomic
class Binary(object):
"""A sedes object for binary data of certain length.
:param min_length: the minimal length in bytes or `None` for no lower limit
:param max_length: the maximal length in bytes or `None` for ... | mmgen/mmgen | mmgen/base_proto/ethereum/rlp/sedes/binary.py | Python | gpl-3.0 | 1,932 |
# coding:utf-8
def train_func(message, session):
return ('回复: 出发日期 **到** \n例如:0506 上海到杭州 \n\n'
'注意:\n🌕上午00:00-12:00\n🌓下午12:00-18:00\n🌑'
'晚上18:00-24:00\n若班次太多,可指定时间段\n'
'如:0506 上海到杭州 上午\n\n班次过多,则只显示班次和出发... | yasongxu/wechat | wechat/event/train.py | Python | mit | 453 |
# -*- coding: utf-8 -*-
'''
Created on 9 Ιαν 2014
@author: tedlaz
'''
import decimal
import datetime
from collections import OrderedDict
import hashlib
def isNum(value): # Einai to value arithmos, i den einai ?
""" use: Returns False if value is not a number , True otherwise
input parameters ... | tedlaz/pyted | tests/pyappgen/pyappgen/num_txt_etc.py | Python | gpl-3.0 | 4,243 |
from __future__ import unicode_literals
from ..requests import UserResponse
from ..requests import UserListResponse
class ReposCollaborators:
def __init__(self, client):
self.client = client
def list(self, repo, user=None):
return self.client.get(
'repos/%s/%s/collaborators' % (
s... | gregorynicholas/flask-github | flask_github/client/repos/reposcollaborators.py | Python | mit | 964 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.