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 |
|---|---|---|---|---|---|
"""
PostgreSQL database backend for Django.
Requires psycopg 2: http://initd.org/projects/psycopg2
"""
import logging
import sys
from django.db.backends import *
from django.db.backends.postgresql_psycopg2.operations import DatabaseOperations
from django.db.backends.postgresql_psycopg2.client import DatabaseClient
fr... | zzeleznick/zDjango | venv/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py | Python | mit | 7,566 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-20 01:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cs_questions', '0007_quizlist'),
]
operations = [
migrations.DeleteModel(
... | wilkerwma/codeschool | src/cs_questions/migrations/0008_delete_quizresponse.py | Python | gpl-3.0 | 360 |
"""
Module for code that should run during LMS startup
"""
# pylint: disable=unused-argument
from django.conf import settings
# Force settings to run so that the python path is modified
settings.INSTALLED_APPS # pylint: disable=pointless-statement
from openedx.core.lib.django_startup import autostartup
import edxm... | htzy/bigfour | lms/startup.py | Python | agpl-3.0 | 4,878 |
from leapp.utils.meta import with_metaclass
class PhaseMeta(type):
classes = []
def __new__(mcs, name, bases, attrs):
klass = super(PhaseMeta, mcs).__new__(mcs, name, bases, attrs)
PhaseMeta.classes.append(klass)
return klass
class Phase(with_metaclass(PhaseMeta)):
@classmethod
... | vinzenz/prototype | leapp/workflows/phases.py | Python | apache-2.0 | 388 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import os, sys, math, MySQLdb, click, time
import pandas as pd
from scripts.rais._to_df import to_df
from numpy import argsort
'''
Usage:
python gini.py -y 2013 -o data/rais/ -a bra -t rais_yb
'''
''' Connect to DB '''
db = MySQLdb.connect(host=os.... | DataViva/dataviva-scripts | scripts/rais/gini.py | Python | mit | 3,050 |
import time
import hark.guest
import hark.log
from hark.lib.command import which, Command
class BaseDriver(object):
def __init__(self, machine):
self.machine = machine
self.guest_config = hark.guest.guest_config(machine['guest'])
@classmethod
def commandPath(cls):
# subclass is ... | ceralena/hark | src/hark/driver/base.py | Python | gpl-3.0 | 1,509 |
import pytest
import numpy as np
import dask.array as da
from dask.array.numpy_compat import _make_sliced_dtype
from dask.array.utils import assert_eq
@pytest.fixture(params=[
[('A', ('f4', (3, 2))), ('B', ('f4', 3)), ('C', ('f8', 3))],
[('A', ('i4', (3, 2))), ('B', ('f4', 3)), ('C', ('S4', 3))],
])
def dtyp... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/dask/array/tests/test_numpy_compat.py | Python | gpl-3.0 | 935 |
# coding=utf-8
"""
permission_required decorator for generic classbased/functionbased view
"""
__author__ = 'mark'
from functools import wraps
from django.http import HttpRequest
from django.utils.decorators import available_attrs
from django.core.exceptions import PermissionDenied
from permission.decorators.utils imp... | somcomltd/django-rbac | rbac/decorators/methodbase.py | Python | mit | 3,130 |
# filename: ex363.py
# Query Linked Movie database endpoint about common actors of
# two directors and output HTML page with links to Freebase.
from SPARQLWrapper import SPARQLWrapper, JSON
director1 = "Steven Spielberg"
director2 = "Stanley Kubrick"
sparql = SPARQLWrapper("http://data.linkedmdb.org/sparq... | agazzarini/SolRDF | solrdf/solrdf-integration-tests/src/test/resources/LearningSPARQLExamples/ex363.py | Python | apache-2.0 | 1,592 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 GNS3 Technologies 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, either version 3 of the License, or
# (at your option) any later version.
... | harrijs/gns3-server | gns3server/modules/dynamips/nios/nio_tap.py | Python | gpl-3.0 | 1,806 |
"""Algorithms for spectral clustering"""
# Author: Gael Varoquaux gael.varoquaux@normalesup.org
# Brian Cheung
# Wei LI <kuantkid@gmail.com>
# License: BSD
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_random_state, as_float_array
from ..u... | mrshu/scikit-learn | sklearn/cluster/spectral.py | Python | bsd-3-clause | 17,408 |
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright (C) 2011-2014
# Christian Kohlöffel
#
# This file is part of DXF2GCODE.
#
# DXF2GCODE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General P... | Poofjunior/dxf2gcode | gui/messagebox.py | Python | gpl-3.0 | 2,949 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2011 Openstack, LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www... | rackerlabs/openstack-guest-agents-unix | commands/freebsd/network.py | Python | apache-2.0 | 8,163 |
# -*- coding: utf-8 -*-
import logging
from django.db import models
from system.official_account.models import OfficialAccount
from system.rule.models import Rule
logger_rule_match = logging.getLogger(__name__)
class RuleMatchManager(models.Manager):
"""
微信规则回复表 Manager
"""
def add(self, rule, plu... | doraemonext/wechat-platform | wechat_platform/system/rule_match/models.py | Python | bsd-2-clause | 2,385 |
# net.py
# A dead-simple neural network
#
# Potential improvements:
# - Support topologies other than 1 hidden layer
# - Add other training strategies (adaptive learning rate, momentum)
# - Add more error checking
import numpy as np
class Net(object):
"""
Neural network class with:
- 1 hidden layer
- ... | gregdeon/simple-ann | src/net.py | Python | mit | 9,516 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import subprocess
import sys
import unittest
COMMAND_PREFIX = 'gettextmath'
def generate_command_call(name, prefix, *args):
return '\\' + prefix + name + '{' + '}{'.join(args) + '}'
class Parser:
class Token:
function = False
def proce... | mplucinski/tex-gettext | tex_math.py | Python | bsd-2-clause | 15,267 |
# -*- coding: utf-8 -*-
# Distributed under the terms of the GNU General Public License v2
| apinsard/appi | .skel.py | Python | gpl-2.0 | 91 |
#coding=gbk
#####################################################################################################
# Program test environment
# Pyhone version:3.4.1
# Firmware version:2.8.28
# Dependent files(MacOSX):libGinkgo_Driver.dylib,libusb-0.1.4.dylib,libusb-1.0.0.dylib,ControlI2C.py
# Dependent files(Windo... | ilab-tongji/raas | sensor/humiture/Python_USB_I2C_AM2321B.py | Python | mit | 3,951 |
"""
Blink LEDs using Raspberry PI GPIO
"""
import RPi.GPIO as GPIO
import time
def blink(pin, num=5, speed=1):
"""Blink LED using given GPIO pin, number of times and speed.
Args:
- pin (int): GPIO pin to send signal
- num (int): num of times to blink (default: 5)
- speed (int): speed ... | kbsezginel/raspberry-pi | scripts/rpi/led/blink.py | Python | bsd-3-clause | 1,077 |
#!/usr/bin/env python
# -*- test-case-name: agdevicecontrol.test.test_resource -*-
#
# AGDeviceControl
# Copyright (C) 2005 The Australian National University
#
# This file is part of AGDeviceControl.
#
# AGDeviceControl is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pub... | pwarren/AGDeviceControl | agdevicecontrol/common/resource.py | Python | gpl-2.0 | 2,011 |
from copy import deepcopy
from datetime import timedelta
import pytest
from django.utils import dateparse, timezone
from events.models import Event
from events.tests.test_event_get import get_detail, get_list
from events.tests.utils import assert_fields_exist, post_event, put_event
from extension_course.models import... | City-of-Helsinki/linkedevents | extension_course/tests/test_api.py | Python | mit | 3,110 |
import tensorflow as tf
import copy
def create_list_object(Object, count):
"""
create a list of obejct using deep copy in
cased used in different theads
Args:
Object: object to be copied
count: the number of copies
Return:
a list of objects
"""
res_lis... | polltooh/traffic_video_analysis | TensorflowToolbox/data_class.py | Python | apache-2.0 | 4,030 |
"""
Django settings for filfinds project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
from django.core.urlresolvers import reverse_lazy
from os.path import dirn... | arminafrancisco/project1 | src/filfinds/settings/base.py | Python | mit | 3,983 |
#!/usr/bin/env python
import unittest
import ncf
import os.path
import subprocess
class TestNcf(unittest.TestCase):
def setUp(self):
self.test_technique_file = os.path.realpath('test_technique.cf')
self.test_generic_method_file = 'test_generic_method.cf'
self.technique_content = open(self.test_techniqu... | ncharles/ncf | tests/unit/test_ncf.py | Python | gpl-3.0 | 5,927 |
import urllib
import urllib2
import pprint
import json
import datetime
import time
import logging
from calendar_bot import CalendarClient
'''returns 'TANAAN!!' if today is paapaiva and string for something else
returns None if no paapaiva in next 10 days
'''
def is_paapaiva(client):
#the events from raati15 cal... | miikama/telegram-bot | bot2.py | Python | mit | 4,609 |
#
# Handle the special case of the first scenario
#
self.notebook.switchScenario(0,scenarioType="Powder")
#
#
#
tab = self.notebook.mainTab
tab.settings['Program'] = 'castep'
tab.settings['Output file name'] = 'phonon.castep'
tab.settings['Excel file name'] = 'analysis_bruggeman.xlsx'
tab.settings['Script file name'] =... | JohnKendrick/PDielec | Examples/Castep/MgO/application_note_bruggeman.py | Python | mit | 12,568 |
#!/usr/bin/env python
import time, os, sys
def writetofile(filename,mysize):
mystring = "The quick brown fox jumps over the lazy dog"
writeloops = int(1000000*mysize/len(mystring))
try:
f = open(filename, 'w')
except:
print "Error writing"
raise
for x in range(0, writeloops):
f.write(mystring)
f.close(... | sanderjo/disk-speed | diskspeed-dir-or-file-name.py | Python | gpl-3.0 | 1,485 |
"""Fine-tune the estimated chip rate of a positioning signal."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import numpy as np
import scipy
from thrifty.carrier_sync import DefaultSynchronizer
f... | swkrueger/Thrifty | scripts/chip_rate_search.py | Python | gpl-3.0 | 4,845 |
# -*- coding:utf-8 -*-
import sys
sys.path.append("../luna-data-pre-processing")
import os
from glob import glob
import numpy as np
from math import sqrt
from functools import reduce
from skimage import feature, exposure
import SimpleITK as sitk
from tqdm import tqdm
from NoduleSerializer import NoduleSerializer
imp... | xiedidan/luna-network | resnext/filter.py | Python | gpl-3.0 | 3,970 |
import json
from .oauth import OAuth2Test
class OrbiOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.orbi.OrbiOAuth2'
user_data_url = 'https://login.orbi.kr/oauth/user/get'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_token': 'foobar',
})
user_data... | tobias47n9e/social-core | social_core/tests/backends/test_orbi.py | Python | bsd-3-clause | 770 |
from django.test import TestCase
from django.urls import reverse
from django.core import mail
from django.contrib.auth.models import User
from securedpi_locks.models import Lock
class RegistrationTestCase(TestCase):
"""Setup Registration test case."""
def setUp(self):
"""Set up for registration test c... | Secured-Pi/Secured-Pi | securedpi/test.py | Python | mit | 10,525 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Arcus, Inc.
#
# 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
#... | monk-ee/puppetdb-python | tests/v4_fixtures.py | Python | mit | 4,496 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
import time
from extra.safe2bin.safe2bin import safecharencode
from lib.core.agent import agent
from lib.core.common import Backend
from lib.core.common import calc... | golismero/golismero | tools/sqlmap/lib/techniques/dns/use.py | Python | gpl-2.0 | 4,536 |
from boto.s3.connection import S3Connection as Connection
from tornado.options import options
def S3Connection():
kwargs = {}
if options.aws_port and options.aws_host:
kwargs['host'] = options.aws_host
kwargs['port'] = options.aws_port
# if we're using a custom AWS host/port, disable
... | spaceninja/mltshp | lib/s3.py | Python | mpl-2.0 | 820 |
Import("projenv")
import subprocess
version = "git-cmd-not-available"
try:
version = subprocess.check_output(["git", "describe"]).strip()
except:
pass
projenv.Append(CCFLAGS=["-DKBOX_VERSION=\"\\\"{}\\\"\"".format(version)])
| sarfata/kbox-firmware | tools/platformio_cfg_gitversion.py | Python | gpl-3.0 | 236 |
#!/usr/bin/env python
import pika
import sys
credentials = pika.PlainCredentials('admin', 'admin')
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost',
port=5672,
virtual_host='/',
credentials=credentials))
channel = connection.channel()
channel.exchange_declare(exchange=... | joelmir/tornado-simple-api | publisher.py | Python | mit | 643 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Spaghetti: Web Application Security Scanner
#
# @url: https://github.com/m4ll0k/Spaghetti
# @author: Momo Outaadi (M4ll0k)
# @license: See the file 'doc/LICENSE'
import re
class Radware():
@staticmethod
def Run(headers):
_ = False
try:
... | Yukinoshita47/Yuki-Chan-The-Auto-Pentest | Module/Spaghetti/modules/fingerprints/waf/radware.py | Python | mit | 602 |
"""
A Pylearn2 Dataset class for accessing the data for the
facial expression recognition Kaggle contest for the ICML
2013 workshop on representation learning.
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__main... | cosmoharrigan/pylearn2 | pylearn2/scripts/icml_2013_wrepl/emotions/emotions_dataset.py | Python | bsd-3-clause | 4,476 |
#!/usr/bin/env python3
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Copyright (c) 2015-2017 The Bitcoin Unlimited developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import pdb
from test_framework.test_framework i... | Bitcoin-com/BUcash | qa/rpc-tests/fundrawtransaction.py | Python | mit | 27,687 |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... | 111pontes/ydk-py | core/ydk/providers/__init__.py | Python | apache-2.0 | 1,187 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to manage A10 Networks slb service-group objects
(c) 2014, Mischa Peters <mpeters@a10networks.com>
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 publishe... | haad/ansible-modules-extras | network/a10/a10_service_group.py | Python | gpl-3.0 | 13,447 |
"""airports.py provides an example Steno3D project of airports"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from .base import BaseExample, exampleproperty
from ..point import Mesh0D, Point
fr... | 3ptscience/steno3dpy | steno3d/examples/airports.py | Python | mit | 3,650 |
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIf(bugnumber="rdar://53754063")])
| apple/swift-lldb | packages/Python/lldbsuite/test/commands/expression/completion-crash2/TestCompletionCrash2.py | Python | apache-2.0 | 174 |
__problem_title__ = "Exploring Pascal's triangle"
__problem_url___ = "https://projecteuler.net/problem=148"
__problem_description__ = "We can easily verify that none of the entries in the first seven rows " \
"of Pascal's triangle are divisible by 7: However, if we check the " \
... | jrichte43/ProjectEuler | Problem-0148/solutions.py | Python | gpl-3.0 | 999 |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) Bitcraze AB
#
# Crazyfl... | bitcraze/crazyflie-lib-python | test/crtp/test_crtpstack.py | Python | gpl-2.0 | 2,797 |
import cv2
import sys
#import matplotlib.pyplot as pt
import numpy as np
import numpy.linalg as la
import math as mt
#Content of out eigens
<<<<<<< HEAD:face_recognition.py
# there would be five images of each person
# the collumns would be the frob norm of each type
# 4 rows for each person
# 1)Smiling
# 2)Sad
# 3)Se... | timothyong/hackillinois | face_recognition.py | Python | mit | 5,724 |
import functools
import logging
import simplejson
import werkzeug.utils
from werkzeug.exceptions import BadRequest
import openerp
from openerp import SUPERUSER_ID
import openerp.addons.web.http as oeweb
from openerp.addons.web.controllers.main import db_monodb, set_cookie_and_redirect, login_and_redirect
from openerp... | inovtec-solutions/OpenERP | openerp/addons/auth_oauth/controllers/main.py | Python | agpl-3.0 | 4,484 |
# -*- 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/v9/services/services/feed_item_set_link_service/transports/base.py | Python | apache-2.0 | 4,414 |
# -*- coding: UTF-8 -*-
# File: naming.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>
GLOBAL_STEP_OP_NAME = 'global_step'
GLOBAL_STEP_VAR_NAME = 'global_step:0'
# extra variables to summarize during training in a moving-average way
MOVING_SUMMARY_VARS_KEY = 'MOVING_SUMMARY_VARIABLES'
# placeholders for input variables
I... | yinglanma/AI-project | tensorpack/utils/naming.py | Python | apache-2.0 | 700 |
# -*- coding: UTF-8 -*-
"""
Unit tests for :class:`click_configfile.ConfigFileReader`.
"""
from __future__ import absolute_import
import os.path
# -----------------------------------------------------------------------------
# TEST SUPPORT
# ---------------------------------------------------------------------------... | jenisys/click-configfile | tests/_test_support.py | Python | bsd-3-clause | 698 |
# Copyright 2015 VPAC
#
# This file is part of Karaage.
#
# Karaage 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.
#
# Karaage is dist... | Karaage-Cluster/karaage-debian | karaage/plugins/kgsoftware/forms.py | Python | gpl-3.0 | 4,299 |
import sys
#sys.path.append('/home/candice/Documents/xxx/music21-1.9.3/music21')
#Alternative: Terminal: cd <path of the folder> then sudo setup.py install
# import PyQt4 QtCore module
from PyQt4.QtCore import *
from music21 import *
#Import and parse an XML file (Example from http://web.mit.edu/music21/)
#sBach = ... | Can123dice/Revisionista | main.py | Python | gpl-2.0 | 935 |
from bs4 import BeautifulSoup
import requests
from random import choice
from io import BytesIO
# default parameters for https://pixabay.com/de/photos
params = {
"min_height": None,
"orientation": None,
"image_type": None,
"cat": None,
"q": None,
"min_width": None,
"order": "ec",
"colors": None,
"pagi": None
}... | Richie-8DK/randomTaquin | grab.py | Python | gpl-3.0 | 1,724 |
# Natural Language Toolkit: Toolbox Reader
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# URL: <http://nltk.org>
# For license information, see LICENSE.TXT
"""
Module for reading, writing and manipulating
Toolbox databases and settings files.
"""
from __future__ import print_fu... | abad623/verbalucce | verbalucce/nltk/toolbox.py | Python | apache-2.0 | 17,965 |
#!/usr/bin/env python
"""DismalPy: a collection of resources for quantitative economics in Python.
"""
DOCLINES = __doc__.split("\n")
import os
import sys
import subprocess
if sys.version_info[:2] < (2, 6) or (3, 0) <= sys.version_info[0:2] < (3, 2):
raise RuntimeError("Python version 2.6, 2.7 or >= 3.2 require... | dismalpy/dismalpy | setup.py | Python | bsd-2-clause | 7,553 |
# -*- coding: utf-8 -*-
# Copyright 2014 Davide Corio
# Copyright 2015-2016 Lorenzo Battistini - Agile Business Group
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import wizard
from . import models
| linkitspa/l10n-italy | l10n_it_fatturapa_out/__init__.py | Python | agpl-3.0 | 225 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | kinnou02/navitia | source/jormungandr/jormungandr/interfaces/v1/test/add_common_status_tests.py | Python | agpl-3.0 | 6,843 |
# no-check-code
| mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/mercurial-2.2.3-py2.7-linux-x86_64-ucs4.egg/mercurial/httpclient/tests/__init__.py | Python | gpl-3.0 | 16 |
'''
menu classes
'''
import subprocess, os
from . import userInput
class BaseMenu(object):
linePad = 50
def __init__(self, db, title, description):
self.db = db
self.title = title
self.description = description
def borderString(self):
columns, rows = userInput.getTerminalSize()
return ''.center(column... | snhobbs/DetectiveBuckPasser | buckPasser/menus.py | Python | unlicense | 6,587 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class User(models.Model):
_inherit = ['res.users']
resume_line_ids = fields.One2many(related='employee_id.resume_line_ids', readonly=False)
employee_skill_ids = fields.One2ma... | t3dev/odoo | addons/hr_skills/models/res_users.py | Python | gpl-3.0 | 1,067 |
from time import sleep
def bar():
sleep(0.1)
def foo():
bar()
bar()
foo()
| vpelletier/pprofile | demo/twocalls2.py | Python | gpl-2.0 | 80 |
import scipy as sp
from scipy.optimize import fsolve
import pylab as plt
import matplotlib
import SW
import numpy as np
###############################################################################################
# Author: Ryan Scheirer #
# Emai... | droundy/deft | papers/thesis-scheirer/final/cotangent.py | Python | gpl-2.0 | 10,941 |
from scrapy.downloadermiddlewares.retry import RetryMiddleware
import logging
logger = logging.getLogger(__name__)
class RedisRetryMiddleware(RetryMiddleware):
def __init__(self, settings):
RetryMiddleware.__init__(self, settings)
def _retry(self, request, reason, spider):
retries = request.... | derekluo/scrapy-cluster | crawler/crawling/redis_retry_middleware.py | Python | mit | 1,117 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/rogerthat/bizz/system.py | Python | apache-2.0 | 40,307 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
from tornado.httputil import url_concat, parse_multipart_form_data, HTTPHeaders, format_timestamp, HTTPServerRequest
from tornado.escape import utf8
from tornado.log import gen_log
from tornado.testing import Expect... | leekchan/tornado_test | tornado/test/httputil_test.py | Python | apache-2.0 | 8,511 |
# coding: utf-8
# pylint: disable=wildcard-import
"""
Provides logic for non API urls
"""
#from .error import *
#from .index import *
#from .user import *
| chdb/DhammaMap1 | main/control/__init__.py | Python | mit | 157 |
# Monitor support
# Copyright (c) 2016, Tieto Corporation
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import time
from remotehost import Host
import config
import rutils
import re
import traceback
import logging
logger = logging.getLogger()
import hostapd
# ... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/remote/monitor.py | Python | gpl-3.0 | 5,448 |
"""Test that we handle inferiors that send signals to themselves"""
from __future__ import print_function
import lldb
import re
from lldbsuite.test.lldbplatformutil import getDarwinOSTriples
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipIfWin... | apple/swift-lldb | packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py | Python | apache-2.0 | 7,195 |
# Copyright 2013-2015 ARM Limited
#
# 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 w... | chase-qi/workload-automation | wlauto/instrumentation/misc/__init__.py | Python | apache-2.0 | 17,103 |
__author__ = u'schmatz'
import errors
import configuration
import mongo
import node
import repositoryInstaller
import ruby
import shutil
import os
import glob
import subprocess
def print_computer_information(os_name,address_width):
print(os_name + " detected, architecture: " + str(address_width) + " bit")
def constr... | 5y/codecombat | scripts/devSetup/factories.py | Python | mit | 3,479 |
from django.contrib.auth.models import User
from django_countries import countries
def get_user(user_id):
user = User.objects.get(id=user_id)
return user
def get_user_profile(user_id):
user = User.objects.get(id=user_id)
return user.profile
def get_ambassadors(country_code=None):
ambassadors = []
a... | ercchy/coding-events | web/processors/user.py | Python | mit | 2,185 |
import globals
from globals import PLATFORM, FROZEN, BASEDIR
from PyQt5.QtWidgets import QSystemTrayIcon, QWidget, QMenu, QSplashScreen
from PyQt5 import QtGui
from PyQt5 import QtPrintSupport
from PyQt5 import QtCore
import sys, webbrowser
from PyQt5.QtCore import *
from PyQt5.QtWebKitWidgets import *
from PyQt5.QtWid... | GeoffMaciolek/aether-public | GUI/guiElements.py | Python | agpl-3.0 | 10,851 |
import time
import functools
import itertools as it
import requests
from requests.exceptions import ConnectTimeout, ReadTimeout, ConnectionError
from circuit import CircuitOpenError
import logging
from .breaker import CircuitBreakerSet
from .exceptions import AllHostsUnreachableException, MaxRetriesReached
logger =... | jbeluch/smartclient | smartclient/client.py | Python | mit | 5,176 |
from django.conf.urls import include, url
from .views import alquiler_nuevo, home
from django.contrib.auth.decorators import login_required
from departamentos.views import home, details
urlpatterns = [
]
| acs-um/deptos | deptos/departamentos/urls.py | Python | apache-2.0 | 209 |
"""Plugins for starting Vumi workers from twistd."""
from vumi.servicemaker import (VumiWorkerServiceMaker,
DeprecatedStartWorkerServiceMaker)
# Having instances of IServiceMaker present magically announces the
# service makers to twistd.
# See: http://twistedmatrix.com/documents/curren... | TouK/vumi | twisted/plugins/vumi_worker_starter.py | Python | bsd-3-clause | 432 |
import sys
import os
from subprocess import call
def cut(filename, out):
with open(filename, 'r') as f:
flag = False
codes = []
for line in f.readlines():
if line.strip() == '```go':
flag = True
elif line.strip() == '```':
with open(ou... | ramrunner/gobgp | test/scenario_test/ci-scripts/build_embeded_go.py | Python | apache-2.0 | 682 |
# -*- coding: utf-8 -*-
###############################################################################
#
# RecentlyTaggedMedia
# Retrieves a list of recently tagged media.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may no... | jordanemedlock/psychtruths | temboo/core/Library/Instagram/RecentlyTaggedMedia.py | Python | apache-2.0 | 4,513 |
import logging
import os
import subprocess
import sys
import shutil
import pkg_resources
import datetime as dt
from pathlib import Path
import pysrt
from PyQt5 import QtCore, QtWidgets, QtGui
from PyQt5.QtWidgets import QLabel, QPushButton, QMessageBox
from quickcut.ordered_set import OrderedSet
from quickcut.widgets... | eddy-geek/quickcut | quickcut/__init__.py | Python | gpl-2.0 | 11,720 |
#! /usr/bin/env python3
import logging
import mwparserfromhell
from ws.client import API
from ws.parser_helpers.wikicode import is_redirect
logger = logging.getLogger(__name__)
class DoubleRedirects:
edit_summary = "fix double redirect"
def __init__(self, api):
self.api = api
def update_redir... | lahwaacz/wiki-scripts | fix-double-redirects.py | Python | gpl-3.0 | 2,435 |
# Copyright (C) 2013 ABRT Team
# Copyright (C) 2013 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... | abrt/faf | src/pyfaf/opsys/fedora.py | Python | gpl-3.0 | 15,625 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from plugins.generic.enumeration import Enumeration as GenericEnumeration
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib... | golismero/golismero | tools/sqlmap/plugins/dbms/hsqldb/enumeration.py | Python | gpl-2.0 | 940 |
# -*- coding: utf-8 -*-
SYMBOL = 'symbol'
POSITIVE_FORMAT = 'positive_format'
NEGATIVE_FORMAT = 'negative_format'
DECIMAL_SYMBOL = 'decimal_symbol'
DIGIT_GROUP_SYMBOL = 'digit_group_symbol'
GROUP_DIGITS = 'group_digits'
CURRENCIES = {
'AED': {
SYMBOL: u'د.إ.',
POSITIVE_FORMAT: u'{symbol} {value}',
NEGAT... | allanlei/django-currency | currencies/__init__.py | Python | bsd-3-clause | 35,230 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import TimeSession
# Register your models here.
admin.site.register(TimeSession) | mooja/eisenhower_dashboard | eisenhower_dashboard/matrix/admin.py | Python | mit | 193 |
from suspect import MRSData, transformation_matrix
import numpy
import struct
import re
# The RDA format consists of a large number of key value pairs followed by raw
# data. The values need to be cast into different datatypes depending on the
# key, this dictionary stores a mapping of key to datatype.
rda_types = {... | bennyrowland/suspect | suspect/io/rda.py | Python | mit | 6,095 |
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | tanium/pytan | BUILD/doc/source/examples/get_userrole_by_id_code.py | Python | mit | 2,787 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.keyvault.keys import KeyClient
from azure.keyvault.keys.crypto import CryptographyClient
from _shared.helpers import mock
def test_key_client_close():
... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-keys/tests/test_context_manager.py | Python | mit | 1,517 |
# -*- coding: utf-8 -*-
import os, sys, shutils
if len(sys.argv) <= 1:
print('debe llamar al sistema usando : ')
print('python3 ' + sys.argv[0] + ' usuario dni')
exit(1)
usuario = sys.argv[1]
dni = sys.argv[2]
os.chdir('/home')
os.rename(usuario,dni)
os.chdir('/home/samba/profiles')
os.rename(usuario,dni... | pablodanielrey/python | gosa/changeOwnerDomain.py | Python | gpl-3.0 | 760 |
import urllib
import logging
import random
from datetime import datetime
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.db import Key
class Move(db.Model):
move = d... | blynn/spelltapper | app/spelltapper.py | Python | gpl-3.0 | 15,729 |
import tkinter
def display():
name = textVar.get()
ch = choice.get()
if ch == 1:
message = "Hello "+name
elif ch == 2:
message = "Goodbye "+name
else:
message = ""
messageLabel.configure(text=message)
top = tkinter.Tk()
textVar = tkinter.StringVar("")
textEntry = tkint... | CajetanP/code-learning | Python/UofG/Year1/Semester2/gui_apps.py | Python | mit | 884 |
# -*- coding: utf-8 -*-
import logging
import sys
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
from unittest.mock import patch
class RunJobTests(TestCase):
def setUp(self):
sys.stdout = StringIO()
sys.stderr = StringIO()
# Rem... | django-extensions/django-extensions | tests/management/commands/test_runjob.py | Python | mit | 3,083 |
from Source import Source
from Components.Element import cached
from Components.Harddisk import harddiskmanager
from Components.config import config
from enigma import eTimer
from Components.SystemInfo import SystemInfo
class HddState(Source):
ALL = 0
INTERNAL = 1
INTERNAL_HDD = 2
INTERNAL_SSD = 3
EXTERNAL = 4
... | athoik/enigma2 | lib/python/Components/Sources/HddState.py | Python | gpl-2.0 | 3,740 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Basic tests for Cerebrum.Entity.EntitySpread. """
import pytest
@pytest.fixture
def entity_spread(Spread, entity_type):
code = Spread('f303846618175b16',
entity_type,
description='Test spread for entity_type')
code.insert()
... | unioslo/cerebrum | testsuite/tests/test_core/test_core_Entity/test_EntitySpread.py | Python | gpl-2.0 | 4,894 |
#!/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 ... | spiceqa/tp-spice | spice/tests/rv_connect_fail.py | Python | gpl-2.0 | 1,694 |
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
from PackageName.PETScFunc import PETScMatOps
def PCD(A, b):
u = PETScMatOps.PETScMultiDuplications(b,3)
A['kspL'].solve(b,u[0])
A['Fp'].mult(u[0],u[1])
A['kspM'].solve(u[1],u[2])
return u[2]
def LSC(A, b):
u... | wathen/PhD | MHD/FEniCS/MyPackage/PackageName/Preconditioners/NSapprox.py | Python | mit | 605 |
import sys
def setup():
return
def run(core, actor, target, commandString):
if actor and target:
core.groupService.handleGroupKick(actor, target)
return
| agry/NGECore2 | scripts/commands/dismissgroupmember.py | Python | lgpl-3.0 | 162 |
from inspect import cleandoc
from coala_utils.decorators import (
enforce_signature, generate_consistency_check)
@generate_consistency_check('definition', 'example', 'example_language',
'importance_reason', 'fix_suggestions')
class Documentation:
"""
This class contains docume... | refeed/coala | coalib/bearlib/aspects/docs.py | Python | agpl-3.0 | 1,522 |
import ast
import sys
import os
import re
from setuptools import setup
path = os.path.join(os.path.dirname(__file__), 'dirty_models', '__init__.py')
with open(path, 'r') as file:
t = compile(file.read(), path, 'exec', ast.PyCF_ONLY_AST)
for node in (n for n in t.body if isinstance(n, ast.Assign)):
if... | alfred82santa/dirty-models | setup.py | Python | bsd-2-clause | 2,158 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##
# Translated source for ComboLeg.
##
# Source file: ComboLeg.java
# Target file: ComboLeg.py
#
# Original file copyright original author(s).
# This file copyright Troy Melhase, troy@gci.net.
#
# WARNING: all changes to this file will be lost.
from ib.lib.overloading i... | kkanahin/ibpy | ib/ext/ComboLeg.py | Python | bsd-3-clause | 2,415 |
import os
from config import config
from incremental_upload_handler import IncrementalUploadHandler
from Utils.util import FileUtil
from file_entity import FileEntity
def gen_test_data():
server_file = os.path.join(config.server_folder,'test.txt')
client_file = os.path.join(config.client_folder,'test.txt')
... | JasonJDong/CompressBinary | IncrementalUpdate/IncrementalUpdate/main.py | Python | gpl-2.0 | 1,595 |
# -*- coding: utf-8 -*-
"""
Tests for QBasic
~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import glob
import os
import unittest
from pygments.token import Token
from pygments.lexers.qbasic import QBasicLexer
class QBa... | markeldigital/design-system | vendor/ruby/2.0.0/gems/pygments.rb-0.6.3/vendor/pygments-main/tests/test_qbasiclexer.py | Python | mit | 1,322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.