code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
import pyven.constants from pyven.steps.step import Step from pyven.checkers.checker import Checker from pyven.logging.logger import Logger from pyven.reporting.content.step import StepListing class Clean(Step): def __init__(self, verbose, nb_threads=1): super(Clean, self).__init__(verbose) self.n...
mgaborit/pyven
source/pyven/steps/clean.py
Python
mit
1,475
""" HTML and RSS based publisher. """ from GitAchievements.publisher.base import Publisher import jinja2 import os.path import re class HtmlPublisher(Publisher): """ HTML and RSS based publisher. """ def __init__(self, app): """ Sets up the HTML and RSS publisher. """ super(HtmlPublisher, self).__init_...
cadyyan/git-achievements-rewrite
GitAchievements/publisher/html.py
Python
mit
1,964
# -*- coding: utf-8 -*- #!/usr/bin/env python import os,sys # system functions import nipype.interfaces.io as nio # Data i/o import nipype.interfaces.fsl as fsl # fsl import nipype.pipeline.engine as pe # pypeline engine import nipype.interfaces.utility as util ...
dpaniukov/RulesFPC
reg/ants_reg.py
Python
mit
8,750
""" Django settings for SmartTrainer project. Generated by 'django-admin startproject' using Django 1.9.1. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import ...
cffls/SmartTrainnerServer
SmartTrainer/SmartTrainer/settings.py
Python
mit
3,292
#!/usr/bin/env python # -*- coding: utf-8 -*- """ TweetFreq - A flask-based web application for analyzing tweets """ from datetime import datetime, timedelta from time import sleep from redis import StrictRedis from flask import Flask, render_template, flash, jsonify, redirect, url_for from flask.json import loads, d...
seanthegeek/TweetFreq
tweetfreq.py
Python
mit
7,488
DEBUG = True THREADS_PER_PAGE = 4 CSRF_ENABLED = True CSRF_SESSION_KEY = 'secret' DATABASE = 'database/rmcontrol.db', SECRET_KEY = 'YOUR_KEY_GOES_HERE_abcdefghijklm', USERNAME = 'admin', PASSWORD = 'default',
ericmagnuson/rmcontrol
config.py
Python
mit
215
import re from django.core.management.base import BaseCommand from openpyxl import load_workbook from api.directions.sql_func import get_confirm_direction_patient_year, get_lab_podr from api.patients.views import full_patient_search_data from clients.models import Individual, Card import datetime class Command(BaseCo...
moodpulse/l2
clients/management/commands/find_card_by_fio.py
Python
mit
3,152
# -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2020 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. """Extensions allow integration of features into a record class. For instance, the system...
inveniosoftware/invenio-records
invenio_records/extensions.py
Python
mit
2,608
import json from random import shuffle class GameState(object): '''simple class to store game data''' FILE_NAME = 'data/savegame.json' default_data = { 'available_levels': ['cloud'], 'locked_levels': ['book', 'feather', 'lamp'], } def __init...
FundacionZamoraTeran/Genios
engine.py
Python
mit
3,831
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Legendgrouptitle(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "scatterpolar" _path_str = "scatterpolar.legendgrouptitle" _valid_props = {"font", ...
plotly/plotly.py
packages/python/plotly/plotly/graph_objs/scatterpolar/_legendgrouptitle.py
Python
mit
4,732
from .credentials_decorator import preserve_credentials_state from .load_yaml import load_yaml_file, load_yaml_directory from .throttle_decorator import throttle
voxy/bluecanary
bluecanary/utilities/__init__.py
Python
mit
162
import json import matplotlib.pyplot as plt import matplotlib as mpl import os from scipy import stats import numpy import commonfunctions as cf root_directory = os.path.dirname(os.path.abspath(os.curdir)) with open('complexity-time-party.json', 'r') as f: results = json.load(f) r, d = [None] * 2 for party in r...
keelanfh/electionary
analysis/complexity-time-party-graph.py
Python
mit
1,683
import sys ''' https://codility.com/demo/results/demoE4F8ST-A8T/ ''' def solution(A): N = len(A) + 1 C = [0 for _ in xrange(N)] for i in xrange(N - 1): if 1 <= A[i] <= N: C[A[i] - 1] = 1 for i in xrange(N): if C[i] == 0: return i + 1 return -1 def...
cowboysmall/codility
src/main/python/lessons/counting_elements/missing_integer.py
Python
mit
424
# -*- coding: utf-8 -*- import pytest from tictail import Tictail from tictail.client import DEFAULT_CONFIG from tictail.resource import Cards class TestClient(object): def test_construction(self, test_token, client): assert client.access_token == test_token assert client.transport is not None ...
tictail/tictail-python
tests/unit/test_client.py
Python
mit
1,884
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe import json from frappe.utils import cstr from frappe import _ from frappe.model.document import Document from frappe.model.docfield import supports_translation cla...
tundebabzy/frappe
frappe/custom/doctype/custom_field/custom_field.py
Python
mit
4,677
#!/usr/bin/env python3 ''' Given two strings, create a function that returns the total number of unique characters from the combined string. ''' def count_unique(s1, s2): return len(set(s1 + s2))
JLJTECH/TutorialTesting
Edabit/SimpleSetLength.py
Python
mit
198
# this model handles game status awareness of the engine # Defines the game object class ### Begin GameVars Definition ### class GameVars(object): def __init__(self, id=False, start_at=False, end_at=False, time_per_food=0, stun_timer=0, cure_timer=0, bite_shares_per_food=0, paus...
evadestruco/pandemic2
models/dbpreloader.py
Python
mit
8,857
# -*- coding: utf-8 -*- from collections import Counter __author__ = "Sergey Aganezov" __email__ = "aganezov(at)cs.jhu.edu" __status__ = "production" class KBreak(object): """ A generic object that can represent any k-break ( k>= 2) A notion of k-break arises from the bioinformatics combinatorial object Br...
aganezov/bg
bg/kbreak.py
Python
mit
5,637
from schedule.models import * import json json_data = open('C:\\Users\\simeon.COMSOFTL\\Desktop\\HackFMI-backend\\FMICalendar-REST\\FMI-Data-master\\teachers.json','rb') data = json.load(json_data) departmentsMap={u'Àëã': 1, u'ÀÌ':2, u'ÂÎÈÑ':3, u'Ãåîì':4, u'ÄÓ':5, u'ÈÑ':6, u'ÈÒ':7, u'ÊÀÒ':8, u'ÊÈ':9, u'ÌËÏ':10, u'ÌÀ...
DeltaEpsilon-HackFMI2/FMICalendar-REST
maper.py
Python
mit
680
def tree_mirror(node): if not node: return node.left, node.right = node.right, node.left tree_mirror(node.left) tree_mirror(node.right)
yangshun/tech-interview-handbook
experimental/utilities/python/tree_mirror.py
Python
mit
160
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/subscription/azure-mgmt-subscription/azure/mgmt/subscription/aio/operations/_subscription_operations.py
Python
mit
15,342
#!/usr/bin/env python import argparse, csv, urllib2, json, base64, getpass from hurry.filesize import size, si parser = argparse.ArgumentParser(description="script that uses Binder's API to add AIP size to the granular ingest report") parser.add_argument('-i', '--input', type=str, required=True, help='source data fil...
finoradin/moma-utils
reporting-tools/bandwidth.py
Python
mit
1,439
class Solution: def hasCycle(self,head): p1 = p2 = head p1 = p1.next p2 = p2.next.next while(p1 != none and p2 != none): p1 = p1.next p2 = p2.next.next if (p1 == p2 ): break if p1==p2 : return True else return False
xlres/leetcode
141.py
Python
mit
305
import RPi.GPIO as GPIO import os import time class ButtonMatrix(): BUTTON_MATRIX = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]] ROW = [22,27,18,17] COLUMN = [10,9,11,23] def __init__(self): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) def buttonPressed(self): ...
akiress/music
ff/matrix.py
Python
mit
2,256
import dropbox from django import forms class ImportForm(forms.Form): def __init__(self, *args, **kwargs): token = kwargs.pop('token') client = kwargs.pop('client') super(ImportForm, self).__init__(*args, **kwargs) choices = [('select_all_option', 'Select All')] metadata =...
phildini/bockus
books/forms.py
Python
mit
671
from spyre import server import matplotlib.pyplot as plt import numpy as np class SimpleApp(server.App): title = "Simple Sine App" inputs = [{ "type": "slider", "key": "freq", "value": 5, "max": 10, "action_id": "sine_wave_plot" }] outputs = [{"type": "plot", ...
adamhajari/spyre
examples/simple_sine_background_image_example.py
Python
mit
897
""" WSGI config for kanjoos project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETT...
vijayaganesh/Kanjoos-HackGT
django-webapp/kanjoos/kanjoos/wsgi.py
Python
mit
392
# vpnr 2 run_trial(rws[22], duration=8.0) run_trial(cm100, duration=8.0, speed=300) run_trial(rws[12], duration=8.0) run_trial(rbs[12], duration=8.0) run_trial(msm2, duration=7.000, speed=200) run_trial(msm1, duration=7.000, speed=200) run_trial(cm100, duration=8.0, speed=150) run_trial(msm1, duration=9.000, speed=150)...
derNarr/synchronicity
experiment/sessions/ses_vp02.py
Python
mit
5,331
import unittest from example import main_1 class TestExample(unittest.TestCase): def test_example_read_file(self): self.assertEqual(main_1(), ['1', '2', '3']) if __name__ == '__main__': unittest.main()
berjc/code-complete
examples/open_file/test.py
Python
mit
224
from flask import (Flask, render_template, session, redirect, url_for, flash ) #eklentiler from flask_bootstrap import Bootstrap from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_script import Manager from flask_wtf import FlaskForm from wtforms import StringField, SubmitField fro...
metmirr/wwwmtndmrcom
flask_egitimi/partone/app/hello.py
Python
mit
2,920
import os import vision_main import serial import commands import time import jenga_logic def versus_human_smart(): ser = serial.Serial('/dev/ttyS0', 9600); print ("serial successful"); t = jenga_logic.create_tower(); currentxyz =[]; while(jenga_logic.current_state(t)): #while tower is still up ...
Robbbb/Jenga
main_first_demo.py
Python
mit
12,229
import numpy as np class SamplingPlannerBase(object): """ Defines the basic functionalities that a sampling based planner should have. """ def __init__(self, collision_checker, state_sampler): pass def set_goal(self, goal_state): pass def set_init(self, init_state): ...
yuhangc/planning_algorithms
algorithms/sampling_based/planner_base.py
Python
mit
410
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Shop.city' db.add_column(u'shop_shop', 'city', ...
fraferra/PlayCity
shop/migrations/0002_auto__add_field_shop_city.py
Python
mit
7,562
try: from setuptools import setup except ImportError: from distutils.core import setup import lua_call setup( name="lua_call", version=lua_call.VERSION, author="Josiah Carlson", author_email="josiah.carlson@gmail.com", url="http://github.com/josiahcarlson/lua-call/", download_url="htt...
josiahcarlson/lua-call
setup.py
Python
mit
860
#the following lines will allow you to use buttons and leds import btnlib as btn import ledlib as led import time #the led.startup() function cycles through the leds led.startup() time.sleep(1) print("All on and off") #to turn on all leds, use the led.turn_on_all() function: led.turn_on_all() time.sleep(2) #to turn o...
majikpig/ubtech
adrianathomas.py
Python
mit
1,727
# -*- coding: utf-8 -*- """ WSGI config for Beniamino_Nobile project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application o...
beniaminonobile/www2017.beniamino_nobile.it
web/wsgi.py
Python
mit
421
from Module import AbstractModule class Module(AbstractModule): def __init__(self): AbstractModule.__init__(self) def run( self, network, antecedents, out_attributes, user_options, num_cores, out_path): import os from genomicode import filelib from genomicode im...
jefftc/changlab
Betsy/Betsy/modules/merge_reads.py
Python
mit
5,930
# pieces by height raw = """ 1 2 211 2 2 11 21 1 11 1 111 1 1 11 """.lstrip() raw_pieces = ["\n".join(line[4*i:4*i+3] for line in raw.splitlines()) for i in range(5)] import numpy def from_heights(s): """Construct 3d array from 2d string of heights""" lines = s.splitlines() shape =...
hickford/soma-cube-solver
soma-cube-solver.py
Python
mit
3,625
""" This module allows to manipulate binary packed objects as classes. Similarly to the standard library struct module, objects can be or unpacked. """ import struct __author__ = 'David Berthelot' def StructClass(name, format, fields, defaults={}): """ :name: The name of the class to create :forma...
david-berthelot/StructClass
structclass/StructClass.py
Python
mit
1,541
class Node(object): """ Constructor to initialize the Node object. """ def __init__(self, val, next=None): self.val = val self.next = next class LinkedList(object): """ Constructor to initialize the List object. """ def __init__(self): self.head = None s...
tanyaweaver/code-katas
src/insert_in_sorted_ll.py
Python
mit
2,551
# global variables import libtcodpy as lib from bearlibterminal import terminal from Classes.Entity import Entity from Classes.Tile import Tile from Classes.Fighter import Fighter from helpers.player_death import player_death SCREEN_WIDTH = 80 SCREEN_HEIGHT = 50 MAP_WIDTH = 80 MAP_HEIGHT = 43 PANEL_HEIGHT = 7 PANEL_...
nuzcraft/RLTut
helpers/variables.py
Python
mit
1,399
# -*- coding: utf-8 -*- import cv2 import numpy as np import math from collections import deque __author__ = 'ecialo' def cut(size): def f(frame): h, w = frame.shape return frame[(h-size)/2:(h+size)/2, (w-size)/2:(w+size)/2] return f def resize_and_cut(size, scale): def f(frame): ...
Ecialo/imsoflexible
rolling_shutter.py
Python
mit
5,186
from os import path class ConfigReader: """Base class for configuration reading. Uses standard python configReader.""" __CONFIG_LIST_SEPARATOR = ',' DEFAULT_SECTION = "DEFAULT" def __init__(self, config, section_name=None, strip_properties=False): """Initializes instalce of Config Reader that...
Superzer0/pyRiverRaid
objects/resources/ConfigReader.py
Python
mit
2,072
# -*- coding: UTF-8 -*- __author__ = 'ARA' __all__ = ['computeLocalID', 'computeGlobalID'] import numpy as np # ... def initLocalID(faces, n, base): dim = len(n) if dim == 1: return initLocalID_1D(faces, n, base) if dim == 2: return initLocalID_2D(faces, n, base) def initLocalID_1D(face...
ratnania/pigasus
python/fem/idutils.py
Python
mit
6,230
N = int(input()) ans = 0 for i in range(N): sh, sm, eh, em = map(int, input().replace(':', ' ').split()) delta = (eh*60 + em) - (sh*60 + sm) if delta < 0: delta += 24*60 ans += delta print(ans)
knuu/competitive-programming
yukicoder/yuki070.py
Python
mit
210
# -*- coding: utf-8 -*- """Read encoder and print position value to LCD.""" from machine import sleep_ms from pyb_encoder import Encoder from hd44780 import HD44780 class STM_LCDShield(HD44780): _default_pins = ('PD2', 'PD1', 'PD6', 'PD5', 'PD4', 'PD3') def main(): lcd.set_string("Value: ") lastval = 0...
SpotlightKid/micropython-stm-lib
encoder/examples/encoder_lcd.py
Python
mit
715
import _plotly_utils.basevalidators class ShapeValidator(_plotly_utils.basevalidators.EnumeratedValidator): def __init__(self, plotly_name="shape", parent_name="scattercarpet.line", **kwargs): super(ShapeValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
plotly/python-api
packages/python/plotly/plotly/validators/scattercarpet/line/_shape.py
Python
mit
514
# MIT License # # Copyright (C) IBM Corporation 2019 # # 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...
IBM/differential-privacy-library
diffprivlib/mechanisms/base.py
Python
mit
7,783
"""Create simple maximum dbz composites for a given UTC date """ import datetime import os import time import sys import subprocess import requests import osgeo.gdal as gdal from osgeo import gdalconst import numpy as np from pyiem.util import get_dbconn, logger, utc LOG = logger() PGCONN = get_dbconn("mesosite", use...
akrherz/iem
scripts/summary/max_reflect.py
Python
mit
4,865
from socketio.namespace import BaseNamespace from socketio.mixins import BroadcastMixin class PointerNamespace(BaseNamespace, BroadcastMixin): user_count = 0 def recv_connect(self): PointerNamespace.user_count += 1 self.broadcast_event('update_count', PointerNamespace.user_count) ...
mburst/gevent-socketio-starterkit
pointer/realtime.py
Python
mit
696
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # # Imports ===================================================================== from .html_parser import HTMLParser from .html_parser import _is_str from .html_parser import _is_dict from .html_parser import _is_iterable # Variables...
Bystroushaak/pyDHTMLParser
src/dhtmlparser/htmlelement/html_query.py
Python
mit
12,034
#encoding:utf-8 import json import string from random import choice from functools import wraps import time import datetime import paramiko from dbutils import MySQLConnection as SQL from dbutils import md5_str from flask import session,redirect class User(object): def __init__(self,username,password,age,telph...
51reboot/actual_09_homework
10/jcui/cmdb/users/modules/modules.py
Python
mit
13,864
from distutils.core import setup import os import afpproxy def read(filename): return open(os.path.join(os.path.dirname(__file__), filename)).read() setup( name = 'afpproxy', author = 'David Buxton', author_email = 'david@gasmark6.com', version = afpproxy.__version__, license = 'MIT', u...
davidwtbuxton/afpproxy
setup.py
Python
mit
782
import json from django.http import HttpResponse from tagging.models import TaggedItem from problem.models import Problem def return_problems(request): if request.method == "GET": tag = request.GET.get("tag", default="tree") queryset = TaggedItem.objects.get_by_model(Problem, tag) problem_id_dic = {"p...
ultmaster/eoj3
api/views/tag.py
Python
mit
460
import cProfile import pstats def profile(func): """Decorator for run function profile""" def wrapper(*args, **kwargs): profile_filename = func.__name__ + '.prof' profiler = cProfile.Profile() result = profiler.runcall(func, *args, **kwargs) profiler.dump_stats(profile_filename...
Alerion/fantasy_map
fantasy_map/utils/profile.py
Python
mit
451
from .editDialog import EditDialog from .payDialog import PayDialog
coinbox/coinbox-mod-sales
cbmod/sales/views/dialogs/__init__.py
Python
mit
68
import flask from hasalog import app @app.route('/login', methods=['GET']) def login(): if flask.g.member: return flask.redirect('/list') return flask.render_template('login.html') @app.route('/logout', methods=['GET']) def logout(): if flask.g.member: session_id = flask.session['sid'] ...
fujimotos/hasalog
hasalog/views/login.py
Python
mit
662
# -*- coding: utf-8 -*- import os import json import argparse import urllib2 from . import bottle self_dir = os.path.dirname(__file__) root_dir = None def _to_json(val): return json.dumps(val, ensure_ascii=True, sort_keys=True) def _remove_keys_copy(d, *keys): d1 = d.copy() for k in keys: try:...
gaorx/mookoo
mookoo.py
Python
mit
7,230
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('barsystem', '0029_person_special'), ] operations = [ migrations.AlterField( model_name='journal', na...
TkkrLab/barsystem
barsystem/src/barsystem/migrations/0030_auto_20150717_1557.py
Python
mit
470
''' Kodi video capturer for Hyperion Copyright (c) 2013-2016 Hyperion Team 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...
poljvd/script.service.hyperion
resources/lib/settings.py
Python
mit
3,422
from __future__ import unicode_literals from django.contrib.staticfiles.finders import find from django.core.files.base import ContentFile from django.utils.encoding import smart_str from pipeline.compilers import Compiler from pipeline.compressors import Compressor from pipeline.conf import settings from pipeline.ex...
zapier/django-pipeline
pipeline/packager.py
Python
mit
4,663
""" `Cargo SQL Numeric and Float Fields` --·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·-- The MIT License (MIT) © 2015 Jared Lunde http://github.com/jaredlunde/cargo-orm """ import copy import decimal import babel.numbers from vital.debug import preprX from cargo.etc.types im...
jaredlunde/cargo-orm
cargo/fields/numeric.py
Python
mit
13,124
import time import io import serial import sys import sensors import logging def write_to_serial(sercon, data): if sercon.isOpen(): if data != None: sercon.write(":{}#".format(data)) serport = serial.Serial(port='/dev/ttyS0', baudrate=9600) write_data = ["SH", "SN0000", "SD04", "F...
Zimcoding/Raspy-Telescope
Raspy-Telescope/test_serial.py
Python
mit
540
#!/usr/bin/env python3 """ responsible for calling other modules and interacting with user To solve the challenge problem, run: ./main.py --count 7 7 -k2 -q2 -b2 -n1 """ import sys from time import time as now import argparse from pieces import ChessPiece from solution import ( find_solutions_s, find_solu...
ilius/chess-challenge
main.py
Python
mit
5,435
from django.db import models from django.contrib.admin.filters import SimpleListFilter from django.utils.translation import gettext_lazy as _ from django.core.exceptions import PermissionDenied from django.template.response import TemplateResponse from django.contrib import admin from django.contrib.admin.utils import ...
stefanw/froide
froide/helper/admin_utils.py
Python
mit
16,318
# -*- coding: UTF-8 -*- # 1.2. use Threading module create thread # use Threading module create thread, from threading.Thread extend, then overwrite __init__ Method and run Method: # !/usr/bin/python import threading import time exitFlag = 0 class myThread(threading.Thread): # extend father threading.Thread ...
xiaoyong0312/Python-dev
Python2.x/Python2.x-1-high/101_thread_1.2.py
Python
mit
1,117
#!/usr/bin/env python from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext ext_modules = [ Extension('sidewinder._sidewinder', [ 'sidewinder/_sidewinder.pyx', 'sidewinder/sidewinder.c' ]), ] setup( name='sidewinder', version='0.1.0',...
easies/sidewinder
setup.py
Python
mit
929
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations ######################################################################### ## This is a sample controller ## - index is the default action of any application ## - user is required for authentication and authorization...
prateekgupta3991/localrecon
controllers/reconciliotastic.py
Python
mit
6,655
""" Python program that writes sentence-based concordance of an input file to another output file. Usage: python concordance.py [path/to/input/file] [path/to/output/file] """ import sys import string import locale import functools def concordanceLexicon(string_list): """ Returns dictionary of sentence-based...
julio73/scratchbook
code/concordance/concordance.py
Python
mit
2,003
from flask import request, jsonify from flask_login import login_required, current_user, \ login_user, logout_user from sixquiprend.models.user import User from sixquiprend.sixquiprend import app @app.route('/login', methods=['POST']) def login(): user = User.login(request.get_json()['username'], request.get_...
nyddogghr/SixQuiPrend
sixquiprend/routes/login_logout.py
Python
mit
856
question_type = 'input_output' source_language = 'C' hotspot_declarations = [ ['$x','int'],['$y','int'], ['$out0','string'],['$out1','string'],['$out2','string'], ['$out3','string'],['$out4','string'],['$out5','string'], ['$out6','string'],['$out7','string'],['$out8','string'], ] group_list = [ ['swap_io_', ...
stryder199/RyarkAssignments
Assignment2/ttt/eop/chapter3/swap_io.py
Python
mit
966
from .parse_links_for_text import parse_links_for_text def flip_instructor(name): string_to_split = reversed(name.split(',')) actual_name = ' '.join([name_part.strip() for name_part in string_to_split]) return actual_name.strip() def split_and_flip_instructors(instructors): # Take a string like 'Bri...
StoDevX/course-data-tools
lib/split_and_flip_instructors.py
Python
mit
511
from .config import Config from .domain import Domain from .calendar import Calendar, SyncedCalendar
ternus/gcal-bridge
gcalbridge/__init__.py
Python
mit
101
from django.contrib import admin from charms.models import Charm # Register your models here. admin.site.register(Charm)
velxundussa/Storyteller
charms/admin.py
Python
mit
123
#!/usr/bin/env python3 ''' You have a function with one side of the DNA string; you need to get the other complementary side. DNA_strand ("ATTGC") # return "TAACG" DNA_strand ("GTAT") # return "CATA" ''' def DNA_strand(dna): d = {"A":"T", "T":"A", "G":"C", "C":"G"} replaced = ''.join(d.get(char, char) for char ...
JLJTECH/TutorialTesting
CodeWars/2019/CompDNA7k.py
Python
mit
364
#!/usr/bin/env python ''' readNwriteTextFiles.py -- create and read text file options: 'i' followed with line number - insert a line 'e' followed with line number - edit a line 'p' - print whole file any character than abowe - exit ''' import os ls = os.linesep def insertLineNum(option): if...
dragancvetic/py_training
book1/ch03/readNeditTextFile.py
Python
mit
2,056
"""General option parser.""" # Copyright (c) 2001-2009 ElevenCraft Inc. # See LICENSE for details. from optparse import OptionParser from schevo import trace def set_trace(option, opt, value, parser): trace.print_history(value) trace.monitor_level = value trace.log(1, 'Tracing level set to', value) d...
Schevo/schevo
schevo/script/opt.py
Python
mit
583
''' Follow these steps to configure the slash command in Slack: 1. Navigate to https://<your-team-domain>.slack.com/services/new 2. Search for and select "Slash Commands". 3. Enter a name for your command and click "Add Slash Command Integration". 4. Copy the token string from the integration settings and use ...
greginvm/groceries-bot
slack/lambda.py
Python
mit
1,621
# -*- coding: utf-8 -*- import os from openre.agent.server.state import is_running import uuid import signal import logging def stop_process(event, name=None, id=None): """ If name is not None, than check that state have the same name """ # on the second run pid is already in event.context['id'] pi...
openre/openre
openre/agent/server/helpers.py
Python
mit
4,316
def main(): num = 2**1000 res = 0 while(num > 0): res += num % 10 num //= 10 print("If you can trust me, the number you are looking for is " + str(res)) main()
PysKa-Ratzinger/personal_project_euler_solutions
solutions/001-025/16/main.py
Python
mit
194
from flask import request, Flask import ldap app = Flask(__name__) @app.route("/normal") def normal(): """ A RemoteFlowSource is used directly as DN and search filter """ unsafe_dc = request.args['dc'] unsafe_filter = request.args['username'] dn = "dc={}".format(unsafe_dc) search_filter...
github/codeql
python/ql/test/query-tests/Security/CWE-090-LdapInjection/ldap_bad.py
Python
mit
1,512
# coding=utf-8 """Item generator base class .. moduleauthor:: Stéphane Vialette <vialette@gmail.com> """ class TimedItemGenerator(object): """Timed item generator. """ # state NOT_STARTED = 0 RUNNING = 1 STOPPED = 2 # number of produced items NUMBER_OF_ITEMS = 0 def __init__(...
vialette/ultrastorage
ultrastorage/timeditemgenerator/timeditemgenerator.py
Python
mit
2,009
# -*- coding: utf-8 -*- from double_linked import DoubleLinkedList class Queue(object): '''Stack is a composition of LinkedList''' def __init__(self, input=None): self.queue = DoubleLinkedList(input) def enqueue(self, val): self.queue.insert(val) def dequeue(self): shift_va...
paulsheridan/data-structures
src/queue.py
Python
mit
480
__author__ = 'tom.bailey' import pymel.core as pm import pymel.core.datatypes as dt import re import rig.parent_tools as pt reload(pt) def orient_snap(source, target): pm.xform(source, absolute=True, worldSpace=True, rotation=pm.xform(target, q...
tb-animator/tbtools
apps/tb_snaps.py
Python
mit
8,800
import os.path import warnings __version__ = (0, 0, 1) def _get_git_revision(path): revision_file = os.path.join(path, 'refs', 'heads', 'master') if not os.path.exists(revision_file): return None fh = open(revision_file, 'r') try: return fh.read() finally: fh.close() def g...
anscii/django-model-synonyms
msyn/__init__.py
Python
mit
744
# -*- coding: utf-8 -*- """Utils module.""" import os from appdirs import user_data_dir user_data_dir = user_data_dir("iqdb_tagger", "softashell") default_db_path = os.path.join(user_data_dir, "iqdb.db") thumb_folder = os.path.join(user_data_dir, "thumbs")
rachmadaniHaryono/iqdb_tagger
iqdb_tagger/utils.py
Python
mit
259
import math import numpy as np def calcTf(nAllTermsInDoc, nTermInDoc): """ # to unstable (most values are near to each other for all docs) return math.log10( (float(nTermInDoc) / float(nAllTermsInDoc)) + 1 ) """ return float(nTermInDoc) / float(nAllTermsInDoc) def calcIdf(nAl...
CodeLionX/CommentSearchEngine
cse/WeightCalculation.py
Python
mit
2,312
try: import re import sys import socket import struct from functools import reduce from lib.core.exceptions import CrowbarExceptions except Exception as err: from lib.core.exceptions import CrowbarExceptions raise CrowbarExceptions(str(err)) class InvalidIPAddress(ValueError): """...
galkan/crowbar
lib/core/iprange.py
Python
mit
3,398
""" Cria uma classe trem que possui carros. O trem é iterável e cada elemento retornado pela iteração retorna um sring com o número do carro. """ class Train: def __init__(self, cars): self.cars = cars def __len__(self): # len(train) return self.cars def __iter__(self): return ...
opensanca/trilha-python
02-python-oo/aula-05/exemplos/train.py
Python
mit
377
#!/usr/bin/python # TODO: issues with new oauth2 stuff. Keep using older version of Python for now. # #!/usr/bin/env python from participantCollection import ParticipantCollection import re import datetime import pyperclip # Edit Me! # This script gets run on the first day of the following month, and that month's UR...
foobarbazblarg/stayclean
stayclean-2020-february/display-final-after-month-is-over.py
Python
mit
3,059
from praw import Reddit from nltk.sentiment.vader import SentimentIntensityAnalyzer from textblob import TextBlob import matplotlib.pyplot as plt plt.style.use('ggplot') import numpy as np from datetime import datetime import matplotlib.dates as mdates from matplotlib.backends.backend_agg import FigureCanvasAgg as Figu...
gregstarr/SentiSub
reddiTest.py
Python
mit
5,832
#!/usr/bin/python # -- coding: utf-8 -- import sys,thread,string,requests,time,random from socket import * from binascii import hexlify,unhexlify ### DEBUG SEND REQUESTS ### #import httplib # #def patch_send(): # old_send= httplib.HTTPConnection.send # def new_send( self, data ): # print data # ret...
jgrmnprz/mycrime
myrequests_srv.py
Python
mit
3,474
#!/usr/bin/env python # Helpful little script that spits out a comma-separated list of # language codes for Qt icons that should be included # in binary Agoldcoin distributions import glob import os import re import sys if len(sys.argv) != 3: sys.exit("Usage: %s $QTDIR/translations $AgoldcoinDIR/src/qt/locale"%sys...
icardgod/A-Gold-Coin
contrib/qt_translations.py
Python
mit
624
#!/usr/bin/env python # encoding=utf-8 from __future__ import print_function import os import sys try: from setuptools import setup from setuptools.command.test import test as TestCommand except ImportError: print("This package requires 'setuptools' to be installed.") sys.exit(1) class PyTest(TestCom...
Jobava/mirror-mwclient
setup.py
Python
mit
1,841
import os path = os.path.dirname(os.path.realpath(__file__)) sbmlFilePath = os.path.join(path, 'MODEL1006230098.xml') with open(sbmlFilePath,'r') as f: sbmlString = f.read() def module_exists(module_name): try: __import__(module_name) except ImportError: return False else: ret...
biomodels/MODEL1006230098
MODEL1006230098/model.py
Python
cc0-1.0
427
from setuptools import setup, find_packages import os def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='mexbtcapi', version='0.2', description="The Multi-Exchange Bitcoin API", long_description=read('README.md'), author="Goncalo Pinheira", a...
goncalopp/mexbtcapi
setup.py
Python
cc0-1.0
1,144
from itertools import dropwhile def least_divisor(k,n): while k < n: if n%k == 0: return k else: k +=1 return n def prime_factors(n): k = 2 N = n factors = [] while N > 1: k = least_divisor(k,N) factors.append(k) N = N/k return factors d...
drcabana/euler-fp
source/py/p03.py
Python
epl-1.0
444
#!/usr/bin/env python # -*- coding: utf-8; -*- # # Copyright (C) 2007-2013 Guake authors # # 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) ...
thardev/guake
src/guake/prefs.py
Python
gpl-2.0
44,668
##################################################################### # -*- coding: iso-8859-1 -*- # # # # Frets on Fire # # Copyright (C) 2006 Sami Kyöstilä ...
fculpo/fofix
fofix/core/Data.py
Python
gpl-2.0
25,953
# Copyright 2011 Justin Santa Barbara # 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...
Snergster/virl-salt
openstack/nova/files/mitaka/nova+virt+driver.py
Python
gpl-2.0
64,183