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/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | j00bar/ansible | lib/ansible/modules/cloud/misc/proxmox.py | Python | gpl-3.0 | 22,785 |
#!/usr/bin/python3.5
import asyncio,aiohttp,threading
import serial
class AsyncSerial(serial.Serial):
def __init__(self,timeout = 0.3,port = "/dev/ttyACM0", baudrate = 9600, *args, **kwargs):
serial.Serial.__init__(self,port = port,baudrate = baudrate, *args, **kwargs)
self.timeout = timeout
def read(self,coun... | daknuett/avr-stdlib | python/miniTTY_serialIO.py | Python | gpl-3.0 | 1,610 |
from addons.base.apps import BaseAddonAppConfig
from addons.dropbox.views import dropbox_root_folder
from addons.dropbox import routes
class DropboxAddonAppConfig(BaseAddonAppConfig):
name = 'addons.dropbox'
label = 'addons_dropbox'
full_name = 'Dropbox'
short_name = 'dropbox'
configs = ['accoun... | mluo613/osf.io | addons/dropbox/apps.py | Python | apache-2.0 | 982 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 07 18:18:50 2017
@author: Leonardo Venancio - Monografia
"""
#from math import sqrt
import numpy as np
import sys
from math import sqrt
print ("Teste Satélite 3D\n")
#dados
c = 299792458 #velocidade da Luz (m/s)
v = 3900 # velocidade orbital dos satélites... | leonardovenan/monografiaGPS | AlgMono(vesion py36).py | Python | apache-2.0 | 10,772 |
from django.conf import settings
from django.core.management.commands.migrate import Command as DjangoMigrateCommand
from django.db import connection
from jsonfield_compat.util import is_db_postgresql
class Command(DjangoMigrateCommand):
def handle(self, *args, **options):
is_postgres = is_db_postgresql(... | kbussell/django-jsonfield-compat | tests/test_app/management/commands/migrate.py | Python | mit | 907 |
symbolrate = 1625e3/6.
slotlen = 625./4
oversamplerate = 1.92e6/symbolrate
Beta = 0.3
BType = ['FB','SB','NB']
samplepreslot = slotlen*oversamplerate
samplepreframe = samplepreslot*8
samplerate = oversamplerate*symbolrate
ts = 1./samplerate
tslot = ts*samplepreslot
tframe = ts*samplepreframe
all0freq =... | ruishihan/R7-with-notes | src/host/python/GSM/GSM.py | Python | apache-2.0 | 366 |
"""Base Service class"""
import base64
import json
import os
from cachecontrol import CacheControl
import requests
from .. import __version__
from mapbox import errors
def Session(access_token=None, env=os.environ):
"""Returns an HTTP session.
:param access_token: Mapbox access token string (optional).
... | perrygeo/mapbox-sdk-py | mapbox/services/base.py | Python | mit | 2,306 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | b1-systems/kiwi | kiwi/filesystem/fat16.py | Python | gpl-3.0 | 1,393 |
from rest_framework.exceptions import APIException
class HasNoPayment(APIException):
status_code = 404
default_detail = "Payment for last month doesnt exist"
default_code = "payment_for_last_month_doesnt_exist"
class PdfDoNotExist(APIException):
status_code = 404
default_detail = "PDF doesnt exi... | auto-mat/klub | apps/pdf_storage/exceptions.py | Python | gpl-3.0 | 363 |
import argparse
import time
from collections import Counter, OrderedDict
import torch
from torchtext.data.utils import get_tokenizer
from torchtext.datasets import DATASETS
from torchtext.experimental.transforms import basic_english_normalize
from torchtext.experimental.vocab_factory import build_vocab_from_text_file,... | pytorch/text | benchmark/benchmark_vocab.py | Python | bsd-3-clause | 4,743 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.rulefit import H2ORuleFitEstimator
def credit():
df = h2o.import_file(pyunit_utils.locate("smalldata/kaggle/CreditCard/creditcard_train_cat.csv"))
df["DEFAULT_PAYMENT_NEXT_MONTH"] = df["DEFAULT_PAYMENT_NEXT... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/rulefit/pyunit_credit_rulefit.py | Python | apache-2.0 | 2,249 |
import os
from flask import Flask, request, redirect, session, send_from_directory
from flask import render_template, send_from_directory
from dlmonitor.db import close_global_session, get_global_session
from dlmonitor.fetcher import get_posts
from dlmonitor import settings
from urllib2 import unquote
import datetime a... | zomux/deepcommunity | dlmonitor/webapp/app.py | Python | gpl-2.0 | 6,313 |
# -*- coding: utf-8 -*-
__author__ = "Filip Koprivec"
from helper import get_file
DAY = 4
data = [line.strip()[:-1].split("[") for line in get_file(DAY)]
def part1(data):
from collections import Counter
su = 0
for line in data:
dat, uid = line[0].rsplit("-", 1)
dat = dat.replace("-", "... | jO-Osko/adventofcode2015 | 2016/python/day4.py | Python | mit | 886 |
from rest_framework import generics
from rest_framework import status
from rest_framework.exceptions import NotFound
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from . import serializers
from .fcm import FCMMessage
from .settings import get_device_model
Device =... | naviens/django-fcm | drf_fcm/views.py | Python | bsd-2-clause | 2,780 |
# -*- 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/types/geo_target_constant_service.py | Python | apache-2.0 | 6,335 |
"""
Giving models a custom manager
You can use a custom ``Manager`` in a particular model by extending the base
``Manager`` class and instantiating your custom ``Manager`` in your model.
There are two reasons you might want to customize a ``Manager``: to add extra
``Manager`` methods, and/or to modify the initial ``Q... | erkanay/django | tests/custom_managers/models.py | Python | bsd-3-clause | 5,847 |
import importlib
import os
from abc import ABC, abstractmethod
from typing import Dict, Optional
class AudioFeatureTransform(ABC):
@classmethod
@abstractmethod
def from_config_dict(cls, config: Optional[Dict] = None):
pass
AUDIO_FEATURE_TRANSFORM_REGISTRY = {}
AUDIO_FEATURE_TRANSFORM_CLASS_NAMES... | pytorch/fairseq | fairseq/data/audio/feature_transforms/__init__.py | Python | mit | 2,611 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio-Previewer-ISPY
# Copyright (C) 2014 CERN
#
# Invenio-Previewer-ISPY 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, o... | tpmccauley/invenio-previewer-ispy | tests/__init__.py | Python | gpl-2.0 | 871 |
# -*- encoding: utf-8 -*-
"""Test class for Operating System UI"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo.constants import (
INSTALL_MEDIUM_URL, PARTITION_SCRIPT_DATA_FILE)
from robottelo.datafactory import invalid_values_list, valid_data_list
from robottelo.decorators impor... | tkolhar/robottelo | tests/foreman/ui/test_operatingsystem.py | Python | gpl-3.0 | 16,652 |
from docs.visitors.node import Node
from docs.visitors.query.query_constructor import QueryConstructor
from docs.visitors.query.query import QueryVisitor
| codebrowse/docs | docs/visitors/query/__init__.py | Python | mit | 155 |
#!/usr/bin/env python3
import logging
from pymesos.utils import parse_duration
class ExecutorConfig(object):
"""This class is responsible for storing the executor config."""
@staticmethod
def parse_time_ms(time_string):
"""Parses the time string and return the milliseconds value.
... | m4ce/Cook | executor/cook/config.py | Python | apache-2.0 | 3,359 |
##########################################
# File: pickle_.py #
# Copyright Richard Stebbing 2014. #
# Distributed under the MIT License. #
# (See accompany file LICENSE or copy at #
# http://opensource.org/licenses/MIT) #
##########################################
# Imports
... | rstebbing/common | rscommon/pickle_.py | Python | mit | 1,022 |
def count_values(dictionary):
"""
"""
seen_values = set()
for i in dictionary:
seen_values.add(dictionary[i])
return len(seen_values)
print(count_values({'red': 1, 'green': 1, 'blue': 2, 'yellow': 3, 'purp': 2}))
| JSBCCA/pythoncode | early_projects/countvalues.py | Python | mit | 244 |
#!/usr/bin/env python3
import optparse
import json
import sys
import os
import swagger_client as api_vels_ob
from swagger_client.rest import ApiException
################
# PARSE PARAMS #
################
parser = optparse.OptionParser()
parser.add_option("--user_task_dir", dest="user_task_dir", type="string")
parse... | autosub-team/autosub | src/plugins/vels_ob/vels_ob.py | Python | gpl-2.0 | 2,942 |
#!/usr/bin/env python
"""
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms of the
* license agreement you ente... | cortical-io/python-client-sdk | cortical/imageApi.py | Python | bsd-2-clause | 4,477 |
# Monthly Solar Radiation Splitter
#solar_splitter_half_months.py
"""
Author:Fricker and Synes
This script is meant to use lidar derived canopy surface models and
output solar radiation rasters for half-monthly periods.
This script incorporates atmospheric transmittance into the solar radiation (from Frank's calculat... | nsynes/M2NEON | Synes/NestedModelDesign/solar_AtmosTransmit.py | Python | gpl-3.0 | 3,849 |
#!/usr/bin/env python
'Unit test for trepan.lib.complete'
import unittest
from trepan.lib import complete as Mcomplete
from trepan.lib import breakpoint as Mbreakpoint
class TestLibComplete(unittest.TestCase):
def test_complete(self):
hash = {'ab': 1, 'aac': 2, 'aa': 3, 'a': 4}
ary = sorted(h... | rocky/python2-trepan | test/unit/test-lib-complete.py | Python | gpl-3.0 | 2,249 |
import pypsa
import numpy as np
import pandapower as pp
from numpy.testing import assert_array_almost_equal as equal
def test_pandapower_case():
# more complicated examples like
# net = pandapower.networks.example_simple()
# can be used once the import of e.g. switches is perfected
# create empty net... | PyPSA/PyPSA | test/test_pf_against_pandapower.py | Python | mit | 2,454 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | nburn42/tensorflow | tensorflow/python/keras/utils/generic_utils_test.py | Python | apache-2.0 | 2,330 |
import django
from django.db import models
from django.db.models.sql.query import LOOKUP_SEP
from django.db.models.deletion import Collector
# from django.db.models.related import RelatedObject
from django.db.models.fields.related import ForeignObjectRel as RelatedObject
from django.forms.forms import pretty_name
from ... | pobear/django-xadmin | xadmin/util.py | Python | bsd-3-clause | 19,558 |
# from doxylink
#import multiprocessing
import itertools
from pyparsing import Word, Literal, alphas, nums, alphanums, OneOrMore, Optional, SkipTo, ParseException, Group, ZeroOrMore, Suppress, Combine, delimitedList, quotedString, nestedExpr, ParseResults, oneOf
# define punctuation - reuse of expressions helps packr... | florian-wagner/gimli | doc/_sphinx-ext/parsing.py | Python | gpl-3.0 | 6,518 |
import numpy as np
import warnings
from . import config
def evaluate(learner, eval_data, metrics, metric_names=None, split_id=None,
write_data=False):
'''
Evaluate `learner` on the instances in `eval_data` according to each
metric in `metric`, and return a dictionary summarizing the values o... | arunchaganty/presidential-debates | third-party/stanza/stanza/research/evaluate.py | Python | mit | 2,875 |
#-*-coding: utf-8 -*-
from signal import SIGINT,SIGTERM,SIGKILL
import time
import os
import sys
class Daemon:
def __init__(self, filename, Logger):
self._Logger = Logger
self._pidFile = os.path.join(sys.path[0], filename)
self.killAll()
# killall process
def killAll(self):
... | moretv/cobweb | client/Cobweb/Process.py | Python | gpl-2.0 | 1,150 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Define PIDStore proxies."""
from __future__ import absolute_import
from flask im... | inveniosoftware/invenio-pidstore | invenio_pidstore/proxies.py | Python | mit | 463 |
## @file intel_process.py
# Post-processing for core and uncore NHM/WTM/SNB events
# are performed in this file for the pickler.
#
# The registers must be reported in the following order in the stats file:
# -# CTL registers
# -# Programmable CTR registers
# -# Fixed CTR registers
# -# If CTL register programming fai... | sdsc/xsede_stats | tacc_stats/pickler/intel_process.py | Python | lgpl-2.1 | 11,861 |
# For the Dev VM environment, we use the same settings as the
# sample prod_settings.py file, with a few exceptions.
from .prod_settings_template import *
import os
from typing import Set
LOCAL_UPLOADS_DIR = 'var/uploads'
# Default to subdomains disabled in development until we can update
# the development documentat... | vaidap/zulip | zproject/dev_settings.py | Python | apache-2.0 | 1,822 |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 13 14:46:01 2014
@author: joser
"""
from armSimulator import armSimulator
import unittest
import random
class armSimulatorTest(unittest.TestCase):
def setUp(self):
self.links = 2
self.arm = armSimulator(800,800,self.links)
... | jrcapriles/armSimulator | tests/armSimulatorTest.py | Python | mit | 1,643 |
import keyboard
import time
# Sends 20 "key down" events in 0.1 second intervals, followed by a single
# "key up" event.
for i in range(20):
keyboard.press('a')
time.sleep(0.1)
keyboard.release('a')
| boppreh/keyboard | examples/simulate_held_down.py | Python | mit | 208 |
import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class RefundModeratedTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 3
def run_test(self):
... | yurizhykin/openbazaar-go | qa/refund_moderated.py | Python | mit | 9,485 |
# -*- 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-network-management | google/cloud/network_management_v1/services/reachability_service/pagers.py | Python | apache-2.0 | 6,157 |
# Copyright 2015 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... | seanli9jan/tensorflow | tensorflow/python/keras/layers/core.py | Python | apache-2.0 | 38,670 |
"""SoftLayer Message Queue transport."""
from __future__ import absolute_import, unicode_literals
import socket
import string
import os
from kombu.five import Empty, text_t
from kombu.utils.encoding import bytes_to_str, safe_str
from kombu.utils.json import loads, dumps
from kombu.utils.objects import cached_propert... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/kombu/transport/SLMQ.py | Python | mit | 6,062 |
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this list
# of conditions and the following disclaimer.... | yhe39/crosswalk-test-suite | tools/atip/atip/android/steps.py | Python | bsd-3-clause | 14,965 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import c... | ravibhure/ansible | lib/ansible/parsing/dataloader.py | Python | gpl-3.0 | 19,503 |
"""Module contains options for various compiler variants.
Attributes:
log (logging.Logger): logger for this module
"""
import re
import logging
from ..utils.flag import Flag
log = logging.getLogger("ECC")
class CompilerVariant(object):
"""Encapsulation of a compiler specific options."""
need_lang_flag... | kgizdov/EasyClangComplete | plugin/completion/compiler_variant.py | Python | mit | 4,282 |
#!/usr/bin/env python
import sys
import math
# INSTRUCTIONS !
# This provided, working code calculates phi coefficients for each code line.
# Make sure that you understand how this works, then modify the traceit
# function to work for function calls instead of lines. It should save the
# function name and the return va... | Quexint/Assignment-Driven-Learning | OCW/[Udacity]Software_Debugging/src/5.SolveTheMystery.py | Python | mit | 10,126 |
#!/usr/bin/pypy
# pylint: disable=line-too-long
"""
compare Timeseries Data in Time for the same value_keys
useful to identify some major differences,
by watching on the Timeseries with the highest MSE values
MSE - Mean Squared Error
"""
import json
import logging
def get_mse(series1, series2):
"""
compare ... | gunny26/datalogger | datalogger/CorrelationMatrixTime.py | Python | apache-2.0 | 7,369 |
# -*- coding: utf-8 -*-
"""
.. _tut-set-eeg-ref:
Setting the EEG reference
=========================
This tutorial describes how to set or change the EEG reference in MNE-Python.
.. contents:: Page contents
:local:
:depth: 2
As usual we'll start by importing the modules we need, loading some
:ref:`example dat... | mne-tools/mne-tools.github.io | 0.19/_downloads/0162af27293b0c7e7c35ef85531280ea/plot_55_setting_eeg_reference.py | Python | bsd-3-clause | 10,338 |
from robottelo.decorators.func_shared.shared import ( # noqa
shared,
SharedFunctionError,
SharedFunctionException,
)
| ldjebran/robottelo | robottelo/decorators/func_shared/__init__.py | Python | gpl-3.0 | 130 |
from django.utils.translation import ugettext_lazy as _
ANY = 99
any_tuple = (ANY, "Any")
minute = tuple([any_tuple] + [(i,i) for i in range(0,60)])
hour = tuple([any_tuple] + [(i,i) for i in range(0,24)])
dom = tuple([any_tuple] + [(i,i) for i in range(1,32)])
month_list = [
_("January"), _("February"), _("... | shawnchin/bbotui | web/bbotui/models/choices_for_cron_scheduler.py | Python | bsd-3-clause | 719 |
# Copyright 2015 OpenStack Foundation
# 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 requ... | Juniper/nova | nova/conf/scheduler.py | Python | apache-2.0 | 33,242 |
# -*-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/perso/cfg_niveaux.py | Python | bsd-3-clause | 3,189 |
from django.contrib import admin
from django.contrib.admin.options import csrf_protect_m
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.urls import reverse
from cms.models import Page, Title
from cms.utils.page_permissions import user_can_change_page
clas... | rsalmaso/django-cms | cms/extensions/admin.py | Python | bsd-3-clause | 4,480 |
# -*- coding: utf-8 -*-
'''
Copyright (C) 2012-2013 Karsten-Kai König <kkoenig@posteo.de>
This file is part of keepassc.
keepassc 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, ... | esn89/keepassc | keepassc/control.py | Python | gpl-3.0 | 56,256 |
# -*- coding: utf-8 -*-
#
# mysqlstmt documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 6 23:50:34 2014.
#
# 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.
#
#... | lovette/mysqlstmt | docs/source/conf.py | Python | bsd-3-clause | 8,316 |
"""
Django settings for api project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... | iver56/useat-api | api/settings/base.py | Python | mit | 2,199 |
"""
Discussion API internal interface
"""
from collections import defaultdict
from urllib import urlencode
from urlparse import urlunparse
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.http import Http404
import itertools
from rest_framework.exceptions imp... | hamzehd/edx-platform | lms/djangoapps/discussion_api/api.py | Python | agpl-3.0 | 28,576 |
x = { 'one': 1, 'two': 2 }
if x['one'] == 1:
print("Correct!")
x['three'] = 3
| mancoast/pycdc | tests/test_dict.py | Python | gpl-3.0 | 82 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operations = [
migrations.CreateModel(
... | grahamgilbert/Crypt-Server | server/migrations/0001_initial.py | Python | apache-2.0 | 3,351 |
from flask import render_template, request, jsonify, Blueprint
from .models import Recipe, Category
from .schemas import RecipeSchema, PaginationSchema
recipes = Blueprint("recipes", __name__)
DEFAULT_PER_PAGE = 10
MAX_PER_PAGE = 1000
@recipes.route('/api/v1/<int:id>')
def api_get_recipe(id):
recipe = Recipe.q... | spk/flask-recipes | app/views.py | Python | mit | 2,282 |
import nltk
import re
# Opens a file containing a corpus and cleans the text.
# <str> eos: string representing the end of a sentence in the corpus
# Returns a string containin'g the cleaned data.
def open_clean(filepath, eos=" xxEnD142xx xxBeGiN142xx "):
text = ''
with open(filepath, 'rb') as f:
print... | bryantwong/shorties | corpus_to_tags.py | Python | gpl-3.0 | 3,536 |
# Copyright 2010 OpenStack Foundation
# 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 requ... | CloudServer/cinder | cinder/tests/unit/api/test_common.py | Python | apache-2.0 | 24,477 |
"""
Plot weigths for the normal-mode decomposition of AR-EEL
spectra of multilayer systems. Reproduces Fig. 2b in [1].
REFERENCES:
[1] Wachsmuth, Hambach, Benner, and Kaiser, PRB (90) 235434 (2014)
Copyright (c) 2014, rhambach, P. Wachsmuth.
This file is part of the EELcalc package and rele... | rhambach/EELcalc | multilayer/examples/4_LEG_areels_weights.py | Python | mit | 1,529 |
# 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 Licen... | JKarathiya/Lean | Algorithm.Python/AddFutureOptionSingleOptionChainSelectedInUniverseFilterRegressionAlgorithm.py | Python | apache-2.0 | 4,948 |
# Copyright 2015 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... | ghchinoy/tensorflow | tensorflow/python/kernel_tests/batch_gather_op_test.py | Python | apache-2.0 | 5,059 |
# -*- coding: utf-8 -*-
import logging
import six
from ccx_keys.locator import CCXLocator
from django.contrib.auth.models import User
from django.db import migrations
from django.http import Http404
from lms.djangoapps.courseware.courses import get_course_by_id
from lms.djangoapps.instructor.access import allow_acc... | stvstnfrd/edx-platform | lms/djangoapps/ccx/migrations/0005_change_ccx_coach_to_staff.py | Python | agpl-3.0 | 3,525 |
class Solution:
def xorOperation(self, n: int, start: int) -> int:
result = 0
for i in range(n):
result ^= start + 2 * i
return result
| jiadaizhao/LeetCode | 1401-1500/1486-XOR Operation in an Array/1486-XOR Operation in an Array.py | Python | mit | 175 |
from django.db import models
from linda_app.models import DatasourceDescription
# A single test over a data source
class EndpointTest(models.Model):
execution_time = models.DateTimeField(auto_now_add=True) # test timestamp
datasource = models.ForeignKey(DatasourceDescription) # tested datasource
up = mo... | LinDA-tools/LindaWorkbench | linda/endpoint_monitor/models.py | Python | mit | 631 |
"""
This example could be run and the results printed from the `examples/util` directory in Disco:
python query_ddb.py <query> <input> ...
"""
import sys
from disco.core import Job, Disco, result_iterator
from disco.worker.classic.func import nop_map
from disco.schemes.scheme_discodb import input_stream
class Query(... | ErikDubbelboer/disco | examples/util/query_ddb.py | Python | bsd-3-clause | 772 |
#!/usr/bin/env python
from signal import SIGTERM
from os import remove, path, kill, getpid, chdir, dup2, fork, setsid, umask
from sqlalchemy.exc import OperationalError
from time import sleep
from datetime import timedelta, datetime
from pytz import timezone
from perception.database.models import OpenvasAdmin,\
Ope... | asrozar/perception | perception/classes/daemons.py | Python | mit | 19,036 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2017 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This ... | grimoirelab/sortinghat | sortinghat/parsing/eclipse.py | Python | gpl-3.0 | 9,218 |
# 11/25/2017 jchoy v0.151 get ip
#-*-coding:utf8;-*-
#qpy:3
##py:webapp:AndyServerWebapp
#qpy://localhost:8081/
"""
qpython webapp with text store
"""
from bottle import run, route, template, static_file
import textstore
import socket
cfgData = {'port':8081, 'path':'/sdcard/devand/scriptOx/pyox1/'}
def cfg(k):
re... | YatneEigenCode/dentre-ortega | baolte-g/python-projects/AndyServerWebapp/main_old.py | Python | gpl-2.0 | 1,232 |
from django.apps import AppConfig
class AnnouncementsConfig(AppConfig):
name = 'Announcements'
| ByrdOfAFeather/AlphaTrion | Announcements/apps.py | Python | mit | 101 |
#!/usr/bin/python
from subprocess import Popen, PIPE, call
from os import path, environ, walk, remove
import re
from shutil import copy
# avconv -i 4k.mp4 -vf crop=256:256:0:0 4k_0_1_0.webm
# avconv -i 4k.mp4 -threads 8 -b:v 2M -c:v libvpx 4.webm
# avconv -i 4k.mp4 -s 896x512 512.mp4
# avconv -i 4.webm -threads 8 -... | geekdenz/foss4g-wms-v | 4kcut.py | Python | gpl-3.0 | 3,729 |
# *****************************************************************************
#
# 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
#
# ... | Thrameos/jpype | test/jpypetest/test_overloads.py | Python | apache-2.0 | 9,541 |
# -*- coding: utf-8 -*-
import unittest
from pynes.compiler import lexical, syntax, semantic
class InyTest(unittest.TestCase):
def test_iny_sngl(self):
tokens = list(lexical('INY'))
self.assertEquals(1, len(tokens))
self.assertEquals('T_INSTRUCTION', tokens[0]['type'])
ast = syn... | edwardpark/pyNES | pynes/tests/iny_test.py | Python | bsd-3-clause | 495 |
import struct
import urllib2,urllib
import re
import json
import math
CRYPT_XXTEA_DELTA= 0x9E3779B9
headers = [('Accept','text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'),( 'Connection','Keep-Alive')]
class Crypt_XXTEA:
_key=None
def setKey(self,key):
if isinstance(key, b... | worldofseries/wos.repositorio | update/plugin.video.worldofseries/playtvfr.py | Python | gpl-2.0 | 9,027 |
#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'AppWall (Radware)'
def is_waf(self):
schema1 = [
self.matchContent(r'CloudWebSec\.radware\.com'),
self.matchHeader(('X-SL-CompState', '.+'))
]
schema2 = [
sel... | EnableSecurity/wafw00f | wafw00f/plugins/radware.py | Python | bsd-3-clause | 732 |
"""
Forest of trees-based ensemble methods.
Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``BaseForest`` base class implements a common ``fit`` method for all
the estimators in the module. The ``fit`` method of the base ``Forest``
class calls th... | xuewei4d/scikit-learn | sklearn/ensemble/_forest.py | Python | bsd-3-clause | 95,788 |
# -*- coding: utf-8 -*-
# Asymmetric Base Framework :: Fields
# Copyright (C) 2013-2014 Asymmetric Ventures Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of th... | AsymmetricVentures/asym-fields | run_tests.py | Python | gpl-2.0 | 2,447 |
"""This file is part of TwitchAposBot.
TwitchAposBot 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.
TwitchAposBot is distributed in the hope... | Apostolique/TwitchAposBot | AposBotSettings.py | Python | gpl-2.0 | 1,045 |
import asyncio
import logging
import logging.config
import signal
import sys
from aioes import Elasticsearch
import click
from pit.es import Index
from pit.index import Indexer, index_collection
from pit.logging import BASE_CONFIG
from pit.stomp import Protocol
from pit.worker import work, cleanup
@click.group()
de... | mitlib-tdm/pit | pit/cli.py | Python | apache-2.0 | 3,322 |
# -*- coding: utf-8 -*-
import logging
import logging.handlers
import radio
import datetime
import sys
import os
class RadioLogger():
"""Radio logger"""
def __init__(self, LOG_FILE, VERBOSE):
"""init the logger"""
# set up formatting for console and the two log files
confor = loggin... | hephaestus9/Radio | radio/logger.py | Python | mit | 2,105 |
import etcd
import time
import uuid
from tendrl.commons import objects
from tendrl.commons.utils import etcd_utils
from tendrl.commons.utils import log_utils as logger
class StopMonitoringServices(objects.BaseAtom):
def __init__(self, *args, **kwargs):
super(StopMonitoringServices, self).__init__(*args, ... | r0h4n/commons | tendrl/commons/objects/cluster/atoms/stop_monitoring_services/__init__.py | Python | lgpl-2.1 | 3,368 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2019 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | CDSherrill/psi4 | psi4/driver/procrouting/sapt/sapt_sf_terms.py | Python | lgpl-3.0 | 10,386 |
from .database import Database, DatabaseError
from .jsonencodeddict import JSONEncodedDict, MutableJSONDict
from .nosql_meta import NoSQLMeta
from .nosql_property import NoSQLProperty
from .sequentialuuid import SequentialUUID
from .shard import Shard, ShardError
__all__ = [
Database,
DatabaseError,
JSONE... | fiacre/FMCSA-scraper | db/__init__.py | Python | gpl-2.0 | 435 |
import string
READ_LETTER_FILE_NAME_START = "combined_one_gram_"
WRITE_LETTER_FILE_NAME = "one_gram_a_z.txt"
READ_LEN_FILE_NAME_START = "one_grams_by_length_RZ_edit/one_gram_len_"
WRITE_LEN_FILE_NAME = "one_gram_all_lengths.txt"
def combine_letter_files():
with open(WRITE_LETTER_FILE_NAME, "a") as write_f:
... | ctlewitt/Invisible-Keyboard | combine_one_gram_letter_files.py | Python | mit | 907 |
#!/usr/bin/env python
import argparse, os.path, sys
from prep import prep
from ldsc_thin import ldscore
from calculate import calculate
import pandas as pd
# returns whether the parent directory of path exists
def parent_dir_exists(path):
return os.path.exists(os.path.abspath(os.path.join(path, os.pardir)))
def... | xtonyjiang/GNOVA | gnova.py | Python | gpl-3.0 | 3,442 |
#!/usr/bin/env python
'''waypoint command handling'''
import time, os, fnmatch, copy, platform
from pymavlink import mavutil, mavwp
from MAVProxy.modules.lib import mp_module
from MAVProxy.modules.lib import mp_util
if mp_util.has_wxpython:
from MAVProxy.modules.lib.mp_menu import *
class WPModule(mp_module.MPMod... | mazafrav/JdeRobot | src/drivers/MAVLinkServer/modules/mavproxy_wp.py | Python | gpl-3.0 | 23,354 |
from checkio.signals import ON_CONNECT
from checkio import api
from checkio.referees.io import CheckiOReferee
from tests import TESTS
api.add_listener(
ON_CONNECT,
CheckiOReferee(
tests=TESTS,
function_name={
"python": "checkio",
"js": "radiationSearch"
}).on_ready... | Bryukh-Checkio-Tasks/checkio-task-radiation-search | verification/referee.py | Python | gpl-2.0 | 322 |
#!/usr/bin/python
import numpy as np
import pylab as plt
import matplotlib.mlab as mlab
import sys
import time
import datetime
import MySQLdb
import math
#-----------------------------------2.75 deg-----------------------------------!
#----------------proton----------------!!--------------deuteron----------------!
#... | whit2333/NucDB | experiments/SLAC-E155/fill_nuclearDB.py | Python | gpl-3.0 | 10,636 |
from random import uniform
from math import log10
import copy
from dark.score import HigherIsBetterScore
from dark.alignments import ReadsAlignments, ReadsAlignmentsParams
from dark.blast.conversion import JSONRecordsReader
from dark.blast.params import checkCompatibleParams
from dark.fasta import FastaReads, SqliteIn... | bamueh/dark-matter | dark/blast/alignments.py | Python | mit | 11,203 |
#!/usr/bin/env python3
import mms
import sympy
eps = 'cos(1.3*x)'
# The highly specific floats below were computed based on inlet conditions of vel=1,T=.01,p=10
# Those primitive values were selected such that the conserved variable values (the float coeffs
# below) were relatively close to unity while ensuring that... | harterj/moose | modules/navier_stokes/test/tests/finite_volume/cns/mms/1d-with-bcs/frictional-varying-porosity.py | Python | lgpl-2.1 | 2,355 |
"""
SimKit tests
"""
from simkit.core import logging
import importlib
import os
import sys
LOGGER = logging.getLogger(__name__)
LOGGER.setLevel(logging.DEBUG)
PROJECT = 'PVPower'
MODEL = 'sandia_performance_model'
TESTS_DIR = os.path.abspath(os.path.dirname(__file__))
PKG_PATH = os.path.abspath(os.path.join(
TEST... | SunPower/Carousel | simkit/tests/__init__.py | Python | bsd-3-clause | 530 |
import numpy as np
class PriceHistoryPack(object):
def __init__(self):
super(PriceHistoryPack, self).__init__()
self.sku_ids = []
self.sequence_lens = []
self.XX = []
self.date_input_table = []
self.seq_mask = []
def update(self, sku_id, inputs, max_seq_len, da... | pligor/predicting-future-product-prices | 04_time_series_prediction/data_providers/price_history_32_pack.py | Python | agpl-3.0 | 2,480 |
from collections import namedtuple
import re
from .base import FIELD_TYPE
from django.utils.datastructures import OrderedSet
from django.db.backends import BaseDatabaseIntrospection, FieldInfo, TableInfo
from django.utils.encoding import force_text
FieldInfo = namedtuple('FieldInfo', FieldInfo._fields + ('extra',))
f... | gdi2290/django | django/db/backends/mysql/introspection.py | Python | bsd-3-clause | 9,317 |
import sys
import mimetypes
from bson import objectid
from pymongo import ReturnDocument
from vj4 import db
from vj4 import error
from vj4.util import argmethod
from vj4.util import pwhash
async def add(content_type):
"""Add a file. Returns MotorGridIn."""
fs = db.fs('fs')
secret = pwhash.gen_secret()
retur... | vijos/vj4 | vj4/model/fs.py | Python | agpl-3.0 | 4,050 |
from datetime import datetime, timedelta
from django.core.management import BaseCommand
from intel.models import *
import logging
import pytz
class Command(BaseCommand):
# Show this when the user types help
help = "Purges old advisories and notes."
def handle(self, *args, **options):
self.logger =... | strikaco/matahari | intel/management/commands/purge.py | Python | mit | 707 |
import logging
import os
import socket
import sys
from .conf import OPTIONS
from .server import get_status
from .server import NotRunning
logger = logging.getLogger(__name__)
def check_other_kolibri_running(port):
try:
# Check if there are other kolibri instances running
# If there are, then we ... | DXCanas/kolibri | kolibri/utils/sanity_checks.py | Python | mit | 2,047 |
"Misc. utility functions/classes for admin documentation generator."
import re
from email.errors import HeaderParseError
from email.parser import HeaderParser
from inspect import cleandoc
from django.urls import reverse
from django.utils.regex_helper import _lazy_re_compile
from django.utils.safestring import mark_sa... | freakboy3742/django | django/contrib/admindocs/utils.py | Python | bsd-3-clause | 7,871 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.