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 |
|---|---|---|---|---|---|
# MIT licensed
# Copyright (c) 2020 lilydjwg <lilydjwg@gmail.com>, et al.
from __future__ import annotations
from nvchecker.api import (
BaseWorker, GetVersionError, RawResult,
)
class Worker(BaseWorker):
async def run(self) -> None:
exc = GetVersionError('no source specified')
async with self.task_sem:
... | lilydjwg/nvchecker | nvchecker_source/none.py | Python | mit | 427 |
import tensorflow as tf
import numpy as np
def add_layer(inputs, in_size, out_size, activation_function=None):
Weights = tf.Variable(tf.random_normal([in_size, out_size]))
biases = tf.Variable(tf.zeros([1, out_size]) + 0.1)
Wx_plus_b = tf.matmul(inputs, Weights) + biases
if activation_function is None:... | zhaotai/tensorflow-practice | tensorboard.py | Python | mit | 1,039 |
import webbrowser
def login():
epassword = None
while epassword != '13': # breaks out of the loop when the password is right
eusername = input('Please enter your username:')
if eusername == 'Justin':
epassword = input('Please enter your password:')
running = True
while ru... | jwfs/jarvis | JARVIS.py | Python | mit | 998 |
import shared
import threading
import time
import sys
from pyelliptic.openssl import OpenSSL
import ctypes
import hashlib
import highlevelcrypto
from addresses import *
from pyelliptic import arithmetic
class addressGenerator(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def ... | onejob6800/minibm | bitmessage/class_addressGenerator.py | Python | mit | 14,710 |
"""
Implementation of TeXSCII
"""
import sys
import copy
from Lexer import Lexer
if __name__ == "__main__":
lex = Lexer()
for line in sys.stdin:
lex.parse_and_print(line)
print "" | PiJoules/TeXSCII | TeXSCII.py | Python | mit | 188 |
import mcpi
from mcpi.block import *
import time
def sandTrap(mc):
pos = mc.player.getTilePos()
mc.setBlocks(pos.x-10,pos.y+15,pos.z-10,pos.x+10,pos.y+18,pos.z+10,SAND)
mc.postToChat("Welcome to the beach!")
def volcanoTrap(mc):
pos = mc.player.getTilePos()
mc.postToChat("Warning.. volcano!")
time.sleep(1... | williamhbell/RpiExamples | python/MinecraftPiFace/python/mcTraps.py | Python | mit | 604 |
# encoding:utf8
# Python使用ORM框架操作数据库
from sqlalchemy import Column, Integer, String, DateTime, create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Scene(Base):
__tablename__ = 'scene' # 表名
id = Column(Integer, prim... | CADTS-Bachelor/playbook | grade-2015/KuangJia/tables.py | Python | mit | 1,462 |
#!/usr/bin/env python
"""
This file computes the raw defect energies (for vacancy and antisite defects)
by parsing the vasprun.xml files in the VASP DFT calculations
for binary intermetallics, where the meta data is in the folder name
"""
#from __future__ import unicode_literals
from __future__ import division
__au... | mbkumar/pydii | pydii/scripts/gen_def_energy.py | Python | mit | 9,062 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import cidonkey.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='BuildInfo',
fields=[
('i... | samuelcolvin/ci-donkey | cidonkey/migrations/0001_initial.py | Python | mit | 5,952 |
#!/usr/bin/env python
import socket
from telnetlib import Telnet
def can_reach(host, port, timeout=5):
try:
tn = Telnet(host, port, timeout)
return 0 # successful posix status
except socket.error, e:
return e.errno
if __name__ == '__main__':
import argparse
import sys
pars... | anthonywu/personal-workspace | python/telnet_ping.py | Python | mit | 608 |
# -*- coding: utf-8 -*-
{
#'Profile': '',
'Sawr': 'ثور',
"Logout": "خروج",
"First Aid": "کمک ها ی اولیه",
"First Aid Refresher": "کمک ها ی اولیه کورس مجدد",
"Community Based Disaster Preparedness": "آماده گی علیه حوادث به سطح جامعه",
"Community Based Disaster Preparedness Refresher": "آماده گی علیه حوادث به سطح جامعه ... | flavour/ifrc_qa | languages/prs.py | Python | mit | 230,573 |
#!/usr/bin/env python
# Copyright (c) 2008 Qtrac Ltd. All rights reserved.
# This program or module 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
# version 3 of the Licens... | GwenIves/Exercises | rgpwp/chapter8/addeditmoviedlg.py | Python | mit | 3,250 |
"""
Project Name: blackjack-bot
File Name: player.py
Author: Connor York (cxy1054@rit.edu)
Updated: 7/20/16
Discord is a voice and chat app for gamers created by Hammer & Chisel, a startup based in Burlingame, CA.
More information on Discord and Hammer & Chisel can be found through the following links:
https://dis... | connoryork/blackjack-bot | player.py | Python | mit | 5,935 |
"""
Django settings for stagecraft project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
from .common import *
# Quick-start development settings - ... | alphagov/stagecraft | stagecraft/settings/development.py | Python | mit | 6,138 |
import re
import logging
import datetime
from urllib.request import urlopen
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
URI = 'https://dre.pt/web/guest/pesquisa-avancada/-/asearch/'
DOCUMENT_ID_FORMAT = URI + '{document_id}' + '/details/{page}/maximized'
PUBLICATION_URL_FORMAT = 'https://dre.... | publicos-pt/pt_law_downloader | pt_law_downloader.py | Python | mit | 7,721 |
from TwitterAPI import TwitterAPI, TwitterConnectionError
import datetime
import re
import os
import sys
import requests
import time
import feedparser
from urllib.parse import urlsplit
from bs4 import BeautifulSoup
from pymongo import MongoClient
class Collector:
def clean_url(self, url):
ga_tokens = ['?... | rueedlinger/tldr | tldr/batch/collector.py | Python | mit | 6,776 |
from .utils import CONF_START, doc_types, cached_property
class IncomingMessage:
def __init__(self, data, method=''):
self.id = data.get('id')
self.date = data['date']
self.body = data.get('text', '')
self.user_id = data['from_id']
if 'peer_id' in data:
self.ch... | kalinochkind/vkbot | vkapi/incoming_message.py | Python | mit | 1,555 |
"""
WSGI config for coviolations_web project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLI... | nvbn/coviolations_web | coviolations_web/wsgi.py | Python | mit | 1,154 |
#!/usr/bin/env python3
import sys
#print(sys.argv)
if len(sys.argv) > 1:
f = open(sys.argv[1], "r")
else:
f = sys.stdin
t = "".join(f.readlines())
i = 0
result = ""
while 1:
if i >= len(t):
break
c = t[i]
if c == '\\':
i += 1
c = t[i]
# unicode sequence
if c == 'u':
x = int(t[i+1:i+5], 16)
# pri... | sheadovas/tools | common/js-deobfuscate/decode_chars.py | Python | mit | 1,174 |
"""Distribution of obs"""
# pylint: disable=no-member
import calendar
import datetime
import pandas as pd
from scipy.stats import norm
import numpy as np
from pyiem.util import get_autoplot_context, get_sqlalchemy_conn
from pyiem.plot import figure_axes
from pyiem import reference
from pyiem.exceptions import NoDataFo... | akrherz/iem | htdocs/plotting/auto/scripts/p6.py | Python | mit | 5,736 |
from django.conf import settings
from django.core.management import BaseCommand, CommandError
from django.utils import timezone
from legalaid.models import Case
class Command(BaseCommand):
help = "Recalculate case.assigned_out_of_hours since a given date"
def __init__(self, *args, **kwargs):
self.un... | ministryofjustice/cla_backend | cla_backend/apps/legalaid/management/commands/recalculate_assigned_out_of_hours.py | Python | mit | 2,913 |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | rsinger86/drf-flex-fields | tests/settings.py | Python | mit | 3,513 |
try:
from django.urls import reverse
except ImportError:
# Django < 2.0
from django.core.urlresolvers import reverse
| ArabellaTech/ydcommon | ydcommon/utils/urls.py | Python | mit | 129 |
from learn import Learner
import sys
# This file shows an example of usage
if not len(sys.argv) == 2:
print "Program must be called with one argument, the filename"
bucket_length = 10
text = file(sys.argv[1]).read()
learner = Learner(bucket_length=bucket_length)
years = learner.predict_year(text, 2, 1000)
print ... | jessegomer/Text-Date-Analyzer | src/analyzer.py | Python | mit | 401 |
from .exceptions import NetworkError
from .form import form
from .typeform import typeform
| grobbie94/typeformPython | typeformPython/__init__.py | Python | mit | 91 |
__author__ = 'Federico - Windows'
from unittest import TestCase
import numpy as np
import pandas as pd
from statsmodels.tools.numdiff import approx_fprime
from ..project.loss_functions.squared_loss import SquareLossFunction
from ..project.loss_functions.squared_loss import LogSquareLossFunction
from ..project.loss_f... | FedericoV/SysBio_Modeling | tests/test_Loss_Functions.py | Python | mit | 11,850 |
import functools
import operator
from chainer.functions.connection import linear
from chainer import initializers
from chainer import link
from chainer import variable
class Linear(link.Link):
"""Linear layer (a.k.a.\\ fully-connected layer).
This is a link that wraps the :func:`~chainer.functions.linear`... | rezoo/chainer | chainer/links/connection/linear.py | Python | mit | 5,148 |
from blog.models import BlogCategory, BlogIndexPage, BlogPage
from django.db import models
from django.utils.translation import ugettext_lazy as _
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.admin.edit_handlers import (
FieldPanel, InlinePanel, MultiFiel... | City-of-Helsinki/digihel | digi/models.py | Python | mit | 11,490 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-02 23:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('galleries', '0004_portfolio_revision'),
]
operations = [... | DylanMcCall/stuartmccall.ca | galleries/migrations/0005_auto_20170502_1618.py | Python | mit | 1,635 |
#!/usr/bin/env python3
from itertools import *
from euler import prod
nums = ( ( 8, 2, 22, 97, 38, 15, 0, 40, 0, 75, 4, 5, 7, 78, 52, 12, 50, 77, 91, 8),
(49, 49, 99, 40, 17, 81, 18, 57, 60, 87, 17, 40, 98, 43, 69, 48, 4, 56, 62, 0),
(81, 49, 31, 73, 55, 79, 14, 29, 93, 71, 40, 67, 53, 88,... | davidxmoody/kata | project-euler/completed/euler11.py | Python | mit | 3,417 |
#!/usr/bin/python
"""
Description: Tool for performing benchmarking of programs
Copyright (c) 2015, Lucian Radu Teodorescu
"""
import os, sys, shutil, time, glob, subprocess, resource, struct, numpy
from collections import defaultdict
import config
testsDir = 'tests'
resultsDir = 'results'
tmpDir = resultsDir + '/... | lucteo/bench_tool | bench_tool.py | Python | mit | 8,930 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for presubmit_support.py and presubmit_canned_checks.py."""
# pylint: disable=no-member,E1103
import StringIO
impor... | Shouqun/node-gn | tools/depot_tools/tests/presubmit_unittest.py | Python | mit | 114,547 |
import pytest
import pickle
import io
from spacy.morphology import Morphology
from spacy.lemmatizer import Lemmatizer
from spacy.strings import StringStore
def test_pickle():
morphology = Morphology(StringStore(), {}, Lemmatizer({}, {}, {}))
file_ = io.BytesIO()
pickle.dump(morphology, file_)
| pombredanne/spaCy | spacy/tests/morphology/test_morphology_pickle.py | Python | mit | 314 |
"""
TEST CASES:
pangram = "The quick, brown fox jumps over the lazy dog!"
Test.assert_equals(is_pangram(pangram), True)
"""
import pytest
TEST_CASES = [
('', False),
('0', False),
('A', False),
('The quick, brown fox jumps over the lazy dog!', True),
('he quick, brown fox jumps over the lazy dog... | bgarnaat/codewars_katas | src/python/6kyu/detect_pangram/test_detect_pangram.py | Python | mit | 536 |
# coding: utf-8
from django.conf.urls import url, patterns
from rest_framework import routers
from dairy import views
router = routers.DefaultRouter()
router.register('day_item', views.DayItemViewSet)
urlpatterns = router.urls
urlpatterns += patterns('dairy.views',
url(r'^get_schedule/$', 'get_schedule'),
) | telminov/school-dairy | backend/dairy/urls.py | Python | mit | 316 |
import RPi.GPIO
import sys
from PIL import Image
sys.path.append("../../")
from gfxlcd.driver.nju6450.gpio import GPIO
from gfxlcd.driver.nju6450.nju6450 import NJU6450
RPi.GPIO.setmode(RPi.GPIO.BCM)
lcd = NJU6450(122, 32, GPIO())
lcd.rotation = 270
lcd.init()
lcd.auto_flush = False
x, y = lcd.width // 2, lcd.height ... | bkosciow/gfxlcd | gfxlcd/demos/nju_3.py | Python | mit | 701 |
import json
import os
import unittest
from xmlstats import xmlstats
access_token = os.getenv("XML_STATS_ACCESS_TOKEN")
user_agent = os.getenv("XML_STATS_USER_AGENT")
class TestXmlStats(unittest.TestCase):
s = xmlstats.Xmlstats(access_token, user_agent)
with open('tests/test_boxscore.json', 'r') as f:
... | danielwelch/xmlstats-py | tests/test_xmlstats.py | Python | mit | 4,161 |
import unittest
from artofmemory.major import NaiveMajorSystem
class TestArtOfMemory(unittest.TestCase):
"""
Test all the things in artofmemory
"""
def test_ts(self):
ret = NaiveMajorSystem().word_to_major("test")
self.assertEqual(ret, "101")
def test_word_with_ph(self):
... | patrickshuff/artofmemory | tests/test_artofmemory.py | Python | mit | 1,401 |
#!/usr/bin/env python3
"""
Generate random trees and sort them.
Time the sorting part.
Print statistics on the times.
"""
import time
from statistics import mean
from randomtrees import *
from treesorting import *
if __name__ == '__main__':
parser = argparse.ArgumentParser('Tree sorting Stress Test')
parse... | robert-impey/tree-sorter | speedtest.py | Python | mit | 1,871 |
'''
Attempt to load HDF5 climate data - 103 MB HDF format
'''
import pandas as pd
import tables
# long string
fname = ('data/1A.GPM.GMI.COUNT2014v3.20150427-S122811-E140041.'
'006595.V03B.HDF5')
# Open HDF file in read mode
weather_pd = pd.HDFStore(fname, 'r')
# tables version easier for preliminary explora... | clarkfitzg/sta242 | weather.py | Python | mit | 561 |
import numpy
import six
from chainer import cuda
from chainer.functions.array import permutate
from chainer.functions.array import transpose_sequence
from chainer.functions.connection import n_step_rnn as rnn
from chainer import link
from chainer.utils import argument
from chainer import variable
def argsort_list_de... | kiyukuta/chainer | chainer/links/connection/n_step_rnn.py | Python | mit | 10,731 |
"""
Django settings for webrat project.
Generated by 'django-admin startproject' using Django 1.9.4.
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 os
# ... | mr-justdoit/webrat | webrat/settings.py | Python | mit | 3,203 |
#!/usr/bin/env python
"""
Show the likelihood and prior for line fitting (with known c) when different prior ranges are used.
"""
import matplotlib.pyplot as pl
import numpy as np
# set plot to render labels using latex
pl.rc('text', usetex=True)
pl.rc('font', family='serif')
pl.rc('font', size=14)
# load data
data... | mattpitkin/GraWIToNStatisticsLectures | figures/scripts/occam_factor.py | Python | mit | 1,895 |
"""
问题描述:设计一种结构,该结构具有如下三个功能:
1.insert(key):将某个key加入到该结构,做到不重复加入
2.delete(key):将原本在结构中的某个key删除
3.get_random():等概率随机返回结构中的任意一个key
要求:
insert、delete和get_random方法的时间复杂度都是O(1)
"""
import random
class RandomPool:
def __init__(self):
self.size = 0
self.key_map = dict()
self.data_map = dict()
... | ResolveWang/algrithm_qa | other/q11.py | Python | mit | 1,186 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def VirtualPointingDeviceBackingOption(vim, *args, **kwargs):
'''The DeviceBackingOption ... | xuru/pyvisdk | pyvisdk/do/virtual_pointing_device_backing_option.py | Python | mit | 1,161 |
# coding: utf-8
"""
Name *.exe file placed in EXE env. var.
Approx. count shardes in
Best if all code in one file. But if file make big best create lib and give it
to shardes.
run only modified Octo.py
"""
import sys
if sys.version_info[0:2] != (2, 6):
raise Exception("Must use python 2.6")
# Std
import os
im... | zaqwes8811/micro-apps | buffer/shard-cpp-test/master-node/_code/task_files/main_task.py | Python | mit | 1,336 |
"""Evaluation and Control Multichain Differential Value Iteration."""
from typing import Union
import numpy as np
from absl import logging
from differential_value_iteration.algorithms import algorithm
from differential_value_iteration.environments import structure
class Evaluation(algorithm.Evaluation):
"""Multich... | abhisheknaik96/differential-value-iteration | src/differential_value_iteration/algorithms/mdvi.py | Python | mit | 12,708 |
# coding: utf-8
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import si... | Royal-Society-of-New-Zealand/NZ-ORCID-Hub | orcid_api_v3/models/family_name_v20.py | Python | mit | 3,047 |
#!/usr/bin/env python
__copyright__ = "Copyright 2015, http://radical.rutgers.edu"
__license__ = "MIT"
import sys
import radical.pilot as rp
import radical.utils as ru
dh = ru.DebugHelper ()
CNT = 0
RUNTIME = 10
SLEEP = 1
CORES = 16
UNITS = 1
SCHED = rp.SCHED_DIRECT_SUBMISSION
... | JensTimmerman/radical.pilot | tests/issue_572.py | Python | mit | 5,093 |
from django.db import models
from django.shortcuts import redirect
from django.views.generic import ListView, FormView, DetailView, UpdateView, DeleteView
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404
from django.utils import timezone
from django.contrib import messages
from ... | fin/froide | froide/team/views.py | Python | mit | 7,454 |
from PyQt5 import QtWidgets
class Module(QtWidgets.QWidget):
def __init__(self, frame, modname):
super(Module, self).__init__(frame)
self.name = modname
self.state = 'INCOMPLETE'
self.input = 0
def getName(self):
return self.name
def getState(self):
return self.state
def changeState(self, changestat... | Saucyz/explode | src/module.py | Python | mit | 605 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Hironori Ishibashi
#
# 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, co... | MetalPhaeton/sayuri | Tools/SayulispEditor/src/linegraph_frame.py | Python | mit | 9,329 |
import os
import argparse
import yaml
import cherrypy
from more_itertools.recipes import consume
from . import datastore
from .pastebin import BASE, Server
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'-c', '--config', dest="configs",
default=[], action="append", h... | yougov/librarypaste | librarypaste/launch.py | Python | mit | 1,902 |
import sys, os, arcpy, math
sys.path.append('.')
import common
TMP_CIRCPTS = 'tmp_circ'
TMP_ALLPOLY = 'tmp_voroall'
with common.runtool(7) as parameters:
common.progress('parsing attributes')
## GET AND PREPARE THE ATTRIBUTES
# obtained from the tool input
points, ptsIDFld, weightFld, normStr, transferFldsStr... | simberaj/interactions | aw_voronoi.py | Python | mit | 2,469 |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
from django.contrib.sitemaps import GenericSitemap
from django.conf.urls import include, url
from wagtail.core import urls as wagtail_urls
from wagtail.admin i... | dchaplinsky/garnahata.in.ua | garnahata_site/garnahata_site/urls.py | Python | mit | 2,269 |
import xml.etree.ElementTree as ET
import datetime
from xml.dom import minidom
def prettify(elem):
"""Return a pretty-printed XML string for the Element."""
rough_string = ET.tostring(elem, "utf-8")
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ")
def dict_to_tag... | manuelRiel/invoice2data | src/invoice2data/output/to_xml.py | Python | mit | 1,916 |
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['ListTest::test_uses_home_template 1'] = '''<html>
<title>Lists</title>
<body>
<table id="id_list_table">
<tr><... | syrusakbary/snapshottest | examples/django_project/lists/snapshots/snap_tests.py | Python | mit | 391 |
"""
The mod:`pyswarms.utils.functions` module implements various test functions
for optimization.
"""
| ljvmiranda921/pyswarms | pyswarms/utils/functions/__init__.py | Python | mit | 102 |
#!/usr/bin/env python
#
# Author: Simone Quatrini of Pen Test Partners
# CVEs: 2019-9879, 2019-9880, 2019-9881
# Tested on Wordpress 5.1.1 and wp-graphql 0.2.3
#
import argparse
import requests
import base64
import json
import sys
parser = argparse.ArgumentParser(description="wp-graphql <= 0.2.3 multi-exploit")
pars... | pentestpartners/snippets | wp-graphql0.2.3_exploit.py | Python | mit | 7,641 |
# This file is auto-generated from recommender.idl(0.6.4-33-gcc8d7ca) with jenerator version 0.5.1-457-g49229fa/master
# *** DO NOT EDIT ***
| hirokiky/jubatus-python-client | jubatus/recommender/__init__.py | Python | mit | 141 |
import os.path
import sys
import pytest
from bonsai import LDAPClient
from bonsai import LDAPEntry
from bonsai import LDAPModOp
from bonsai import LDAPDN
import bonsai.errors
from bonsai.errors import InvalidDN
@pytest.fixture
def test_entry():
""" Create a test LDAP entry. """
gconn = None
entry = None... | Noirello/PyLDAP | tests/test_ldapentry.py | Python | mit | 15,837 |
"""autogenerated by genpy from gc_msgs/StateMsg.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class StateMsg(genpy.Message):
_md5sum = "af6d3a99f0fbeb66d3248fa4b3e675fb"
_type = "gc_msgs/StateMsg"
_has_header = False #flag to mark the presenc... | WeirdCoder/rss-2014-team-3 | devel/lib/python2.7/dist-packages/gc_msgs/msg/_StateMsg.py | Python | mit | 3,722 |
# from win32com.shell import shell, shellcon
import os
import sys
import time
#import pyscreenshot as ImageGrab
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
#import ntsecuritycon
#import win32security
import win32api
import win32gui
import win32ui
import win32con
#import getpass
import date... | operepo/ope | client_tools/svc/sshot.py | Python | mit | 6,201 |
import random
from config import Config
from network import Network
class Genome(object):
networkArchitecture = [2,3,1]
fitness = 0
mutationMinimizer = 1
def __init__(self,network=0):
if network==0:
self.network = Network(self.networkArchitecture)
else:
self.ne... | justinglibert/flapai | genome.py | Python | mit | 1,671 |
"""
Spyder Editor
This temporary script file is located here:
/home/timmonen/.spyder2/.temp.py
"""
from Bio import SeqIO
from Bio import SeqRecord, Seq
import numpy as np
folder_name = "/home/timmonen/projects/example/data/"
reads1 = SeqIO.parse(folder_name+"read1_1000.fastq", "fastq")
myfilename = folder_name+"rea... | timmonen/pipeline | pipeline/trim_runs.py | Python | mit | 1,299 |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param {ListNode} head
# @param {integer} val
# @return {ListNode}
def removeElements(self, head, val):
node = head
last = None
... | lutianming/leetcode | remove_linked_list_elements.py | Python | mit | 714 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Partially based on AboutMethods in the Ruby Koans
#
from runner.koan import *
def my_global_function(a, b):
return a + b
class AboutMethods(Koan):
def test_calling_a_global_function(self):
self.assertEqual(5, my_global_function(2, 3))
# NOTE: ... | ybur-yug/python_koan_solutions | koans/koans/about_methods.py | Python | mit | 5,728 |
import numpy
import cupy
from cupy import _core
from cupy._math import sumprod
from cupy._math import ufunc
sin = ufunc.create_math_ufunc(
'sin', 1, 'cupy_sin',
'''Elementwise sine function.
.. seealso:: :data:`numpy.sin`
''')
cos = ufunc.create_math_ufunc(
'cos', 1, 'cupy_cos',
'''Elemen... | cupy/cupy | cupy/_math/trigonometric.py | Python | mit | 4,308 |
"""
Package for MBook.
"""
| orzbhbdsb/gitlab3 | MBook/MBook/__init__.py | Python | mit | 27 |
import unittest
from nailfile import readers
from nailfile import nailfile
#TODO: Test dump()
class NailFileTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def get_list_data(self):
data = [
['person_num', 'name', 'gender', 'dob', 'relationshi... | mattmc3/NailFile | tests/test_nailfile.py | Python | mit | 4,712 |
import unittest
def path_sum(root, give_sum):
return path_sum_recursive(root, give_sum, [])
def path_sum_recursive(root, given_sum, path):
if root is not None:
path.append(root.val)
if root.is_leaf() and root.val == given_sum:
return [path]
else:
return path_s... | Alex-Diez/python-tdd-katas | path_sum_kata/day_11.py | Python | mit | 2,228 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... | alisaifee/flask-limiter | flask_limiter/_version.py | Python | mit | 18,484 |
"""
Setup file for logstash_formatter as used by Proigia.
This setup file will install the logstash_formatter, as used by Proigia.
Is basically is a 'Patched' version of the python-logstash-formatter by
exoscale. [https://github.com/exoscale/python-logstash-formatter].
"""
import codecs
from os import path
import set... | Proigia/proigia-logstash-formatter | setup.py | Python | mit | 1,317 |
from setuptools import setup
version = '2.0rc6'
long_description = 'LL(1) parser generator with expression parsing support'
setup(
name='hermes-parser',
version=version,
description=long_description,
author='Scott Frazer',
author_email='scott.d.frazer@gmail.com',
packages=['hermes'],
package_data={
... | scottfrazer/hermes | setup.py | Python | mit | 1,176 |
from flask import Flask,request
from wsgi_jsonrpc.json_tools import ServerProxy
from json import dumps
app = Flask(__name__)
@app.route("/create_client")
def create_client():
shaveet = ServerProxy("http://localhost:8082")
client_id = request.args.get('name');
key = shaveet.create_client(client_id)['result']
s... | urielka/shaveet | examples/flask_notification/notification.py | Python | mit | 686 |
# -*- encoding: utf-8 -*-
# Email reminder
# Author: Alex S. Garzão <alexgarzao@gmail.com>
# send_reminder.py
import requests
from send_mail import SendMail
import logging
from string import Template
import base64
class SendReminders:
'''Class responsible in filter the data, to configure the template data and t... | alexgarzao/email_reminders | email_reminders/send_reminders.py | Python | mit | 2,790 |
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print("You have %d cheeses!" % cheese_count)
print("You have %d boxes of crackers!" % boxes_of_crackers)
print("We can just give the function numbers directly")
cheese_and_crackers(20+3, 30+5)
| sunrin92/LearnPython | 1-lpthw/ex19.py | Python | mit | 262 |
from os.path import dirname
from ipkg.build import Formula, File
class loop_a(Formula):
name = 'loop-a'
version = '1.0'
sources = File(dirname(__file__) + '/../../sources/loop-a-1.0.tar.gz')
platform = 'any'
dependencies = ('loop-b', 'loop-c')
def install(self):
pass
| pmuller/ipkg | tests/data/formulas/loop-a/loop-a-1.0.py | Python | mit | 306 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.gg/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse as ti... | huyphan/pyyawhois | test/record/parser/test_response_whois_gg_status_available.py | Python | mit | 1,462 |
# -- encoding: utf-8 --
from __future__ import with_statement
import requests
from stackspy.result import Result
import logging
from stackspy.utils import create_request
try:
from lxml.html import document_fromstring
except ImportError:
document_fromstring = None
log = logging.getLogger(__name__)
class FailedResp... | akx/stackspy | stackspy/url_context.py | Python | mit | 2,534 |
from base_Zeus import Zeus_1d_file
from base_dir import Zeus_1d_dir | chrisjdavie/ws_cross_project | Zeus_classes/Zmp_file_1d/__init__.py | Python | mit | 67 |
pyg = 'ay'
original = raw_input('Enter a word:')
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
print pyg
else:
print 'empty'
| ummahusla/codecademy-exercise-answers | Language Skills/Python/Unit 03 Conditionals and Control Flow/02 PygLatin/PygLatin PART2/9-Move it on back.py | Python | mit | 217 |
"""
Tools for generating *very* basic fake images for HST/JWST/Roman simulations
"""
import os
import numpy as np
import astropy.io.fits as pyfits
import astropy.wcs as pywcs
from . import GRIZLI_PATH
def rotate_CD_matrix(cd, pa_aper):
"""Rotate CD matrix
Parameters
----------
cd : (2,2) array
... | gbrammer/grizli | grizli/fake_image.py | Python | mit | 17,579 |
from chatterbot import ChatBot
class JarvisChatBot:
def __init__(self):
self.jarvis_chatterbot = ChatBot("Jarvis",
storage_adapter="chatterbot.adapters.storage.JsonDatabaseAdapter",
logic_adapter="chatterbot.adapters.logic.ClosestMatchAdapter",
io_adapter="chatterbot.a... | DarkmatterVale/JARVIS | jarvis/chatbot.py | Python | mit | 599 |
import torch
from torch_geometric.loader import DataLoader
import torch.optim as optim
import torch.nn.functional as F
from gnn import GNN
from tqdm import tqdm
import argparse
import time
import numpy as np
### importing OGB
from ogb.graphproppred import PygGraphPropPredDataset, Evaluator
cls_criterion = torch.nn.B... | snap-stanford/ogb | examples/graphproppred/mol/main_pyg.py | Python | mit | 6,894 |
# -*- coding: utf-8 -*-
import copy
import logging
from types import GeneratorType
from django.db import transaction
from yawf.signals import transition_handled
from yawf.utils import select_for_update
from yawf.config import REVISION_ATTR, USE_SELECT_FOR_UPDATE,\
TRANSACTIONAL_SIDE_EFFECT
from yawf import ge... | freevoid/yawf | yawf/state_transition.py | Python | mit | 9,244 |
from integration_tests import strategies as st
from hypothesis.strategies import SearchStrategy
def generate_body(body, size_k):
if size_k and body:
if isinstance(body, list):
length = sum(len(b) for b in body)
else:
length = len(body)
body = body * ((size_k * 1024... | squeaky-pl/japronto | integration_tests/generators.py | Python | mit | 2,001 |
#!/usr/bin/python
import argparse
import copy
import ising
import simulated_annealing
import piqmc
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog="Ising Solvers")
subparsers = parser.add_subparsers(dest = "solver", help="solver selection")
# parser for config file option
p... | ezrasavard/qmc | solve.py | Python | mit | 3,335 |
from drip_retry import *
from drip import *
| SpringboardEdu/drip-py | drip/__init__.py | Python | mit | 44 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Name: stream/core.py
# Purpose: mixin class for the core elements of Streams
#
# Authors: Michael Scott Cuthbert
# Christopher Ariza
#
# Copyright: Copyright © 2008-2015 Michael S... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/stream/core.py | Python | mit | 14,410 |
__author__ = "Jonas Geduldig"
__date__ = "June 8, 2013"
__license__ = "MIT"
from requests.exceptions import ConnectionError, ReadTimeout, SSLError
from requests.packages.urllib3.exceptions import ReadTimeoutError, ProtocolError
from .TwitterError import *
import requests
import time
class TwitterRestPager(object):
... | rosudrag/Freemium-winner | VirtualEnvironment/Lib/site-packages/TwitterAPI/TwitterRestPager.py | Python | mit | 3,605 |
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import json
import functools
import click
from radish.errors import RadishError
from radish.extensionregistry import extension
from radish.h... | radish-bdd/radish | src/radish/extensions/cucumber_json_writer.py | Python | mit | 4,729 |
# Copyright (c) 2020 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import json
from logging import DEBUG
from toolz import merge
from django.db import transaction
from chroma_core.lib.storage_plugin.api import attributes
from chroma_co... | intel-hpdd/intel-manager-for-lustre | chroma_core/plugins/linux.py | Python | mit | 23,336 |
from globals import sqc
from PyQt4.QtGui import QWidget
from PyQt4.QtCore import SIGNAL
from workthread import WorkThread
class Parser(QWidget):
def __init__(self,parent):
QWidget.__init__(self,parent)
self.parent = parent
self.par_thread = WorkThread()
self.connect(self.par_thread... | pyros2097/SabelIDE | core/parser.py | Python | mit | 1,603 |
from __future__ import absolute_import
from .. import conf
from ..utils.import_tools import import_class
def get_storage(backend=None):
if not backend:
backend = conf.STORAGE_BACKEND
backend_class = import_class(backend)
return backend_class()
| msabramo/tally | tally/storage/__init__.py | Python | mit | 269 |
from rest_framework import viewsets, status, serializers
from rest_framework.response import Response
from crowdsourcing.serializers.template import TemplateItemSerializer, TemplateItemPropertiesSerializer, \
TemplateSerializer
class TemplateViewSet(viewsets.ModelViewSet):
from crowdsourcing.models import Te... | shirishgoyal/crowdsource-platform | crowdsourcing/viewsets/template.py | Python | mit | 1,350 |
import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="showtickprefix", parent_name="isosurface.colorbar", **kwargs
):
super(ShowtickprefixValidator, self).__init__(
plotly_name=plotly_na... | plotly/python-api | packages/python/plotly/plotly/validators/isosurface/colorbar/_showtickprefix.py | Python | mit | 568 |
# 50m maps of all states (10m Alaska shape)
import os
import sys
import argparse
# Global variables
xd_width, xd_height = 1200, 900
base_dir = '/Users/monad/Work/data'
cult10m_dir = os.path.join(base_dir, '10m_cultural', '10m_cultural')
phys10m_dir = os.path.join(base_dir, '10m_physical')
cult50m_dir = os.path.join... | monadius/mapnik2_maps | usa50_50m.py | Python | mit | 11,452 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from collections import OrderedDict
from datetime import datetime... | mic4ael/indico | indico/modules/events/management/controllers/cloning.py | Python | mit | 7,817 |
from django.conf.urls.defaults import *
from blog.models import Post
urlpatterns = patterns('',
# Latest
url(r'^$',
'django.views.generic.date_based.archive_index',
{
'queryset': Post.objects.filter(published=True),
'date_field': 'posted_on',
'num_latest': ... | staer/mosbius | mosbius/apps/blog/urls.py | Python | mit | 2,090 |