text stringlengths 0 1.05M | meta dict |
|---|---|
"""ARTICLE MODELS
Article
"""
from django.db import models
from ckeditor.fields import RichTextField
from django.utils import timezone
from django.utils.text import slugify
class Article(models.Model):
"""Article
post id: primary key, autoincrement
title: length=250
body: ckeditor
... | {
"repo_name": "efueger/harshp.com",
"path": "articles/models.py",
"copies": "1",
"size": "2537",
"license": "mit",
"hash": -4947090653001015000,
"line_mean": 22.4907407407,
"line_max": 75,
"alpha_frac": 0.5530153725,
"autogenerated": false,
"ratio": 4.51423487544484,
"config_test": false,
"ha... |
'''This module contains the data model for Articles in blog sources.'''
import codecs
import datetime
import os
import lpbm.models.configmodel as cm_module
import lpbm.tools as ltools
from lpbm.lib.slugify import SLUG_CHARS_DISPLAY as _SLUG_CHARS_DISPLAY
from lpbm.lib.slugify import slugify as _slugify
class Artic... | {
"repo_name": "fmichea/lpbm",
"path": "lpbm/models/articles.py",
"copies": "1",
"size": "8616",
"license": "bsd-3-clause",
"hash": -7671744794293129000,
"line_mean": 31.8854961832,
"line_max": 83,
"alpha_frac": 0.5775301764,
"autogenerated": false,
"ratio": 4.054588235294117,
"config_test": tru... |
"""articles_column
Revision ID: 49f02f2c2ea
Revises: 171e70161dd
Create Date: 2016-03-19 22:38:51.402128
"""
# revision identifiers, used by Alembic.
revision = '49f02f2c2ea'
down_revision = '171e70161dd'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | {
"repo_name": "XiaochenCui/algorithm_submit",
"path": "migrations/versions/49f02f2c2ea_articles_column.py",
"copies": "1",
"size": "2229",
"license": "mit",
"hash": 9076071015691817000,
"line_mean": 34.9516129032,
"line_max": 91,
"alpha_frac": 0.6603858232,
"autogenerated": false,
"ratio": 3.4398... |
"""articles
Revision ID: 2223792e165
Revises: 13d42a02406
Create Date: 2016-03-19 21:58:27.811507
"""
# revision identifiers, used by Alembic.
revision = '2223792e165'
down_revision = '13d42a02406'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please ad... | {
"repo_name": "XiaochenCui/algorithm_submit",
"path": "migrations/versions/2223792e165_articles.py",
"copies": "1",
"size": "1075",
"license": "mit",
"hash": -9171602199706998000,
"line_mean": 28.8611111111,
"line_max": 89,
"alpha_frac": 0.6688372093,
"autogenerated": false,
"ratio": 3.4126984126... |
'''Articulated "skeleton" class and associated helper functions.'''
import logging
import numpy as np
import ode
from . import parser
from . import physics
def pid(kp=0., ki=0., kd=0., smooth=0.1):
r'''Create a callable that implements a PID controller.
A PID controller returns a control signal :math:`u(t)... | {
"repo_name": "EmbodiedCognition/pagoda",
"path": "pagoda/skeleton.py",
"copies": "1",
"size": "13358",
"license": "mit",
"hash": 9160017352299570000,
"line_mean": 33.5167958656,
"line_max": 83,
"alpha_frac": 0.6011378949,
"autogenerated": false,
"ratio": 4.1717676452217365,
"config_test": fals... |
"""Artifactory purger module."""
import base64
import datetime
import logging
import certifi
import party
# pylint: disable=redefined-builtin
from requests.exceptions import (BaseHTTPError, ConnectionError, HTTPError, InvalidURL, RequestException)
from ..credentials import load_credentials
LOG = logging.getLogger(_... | {
"repo_name": "gogoair/lavatory",
"path": "src/lavatory/utils/artifactory.py",
"copies": "1",
"size": "10148",
"license": "apache-2.0",
"hash": 9156925701365416000,
"line_mean": 39.592,
"line_max": 118,
"alpha_frac": 0.5832676389,
"autogenerated": false,
"ratio": 4.240702047638947,
"config_test... |
# artifacts default extension
ARTIFACTS_EXTENSION = '.feature'
# regex support string
FEATURE = 'feature'
SCENARIO = 'scenario'
ACTOR = 'as_a'
VALUE_PROPOSITION = 'so_that'
OBJECTIVE = 'i_wanna'
CONTEXT = 'given'
ACTION = 'when'
EXPECTED_BEHAVIOR = 'then'
LANGUAGE = 'language'
# default filename for exports
DEFAULT_F... | {
"repo_name": "yurireeis/bddocs",
"path": "bddocs/config/settings.py",
"copies": "1",
"size": "1317",
"license": "mit",
"hash": 6608844391406785000,
"line_mean": 33.6578947368,
"line_max": 87,
"alpha_frac": 0.7661351557,
"autogenerated": false,
"ratio": 3.2761194029850746,
"config_test": false,... |
"""Artificial Adversarial Searches"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import random
import time
import numpy as np
import six
from . import base
@six.add_metaclass(abc.ABCMeta)
class Adversarial(base.SearchBase):
"""Adversarial Search.
Parameters
-------... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/searches/adversarial.py",
"copies": "1",
"size": "4290",
"license": "mit",
"hash": -720069562844128600,
"line_mean": 28.5862068966,
"line_max": 74,
"alpha_frac": 0.593006993,
"autogenerated": false,
"ratio": 3.885869565217391,
"config_t... |
"""Artificial Agents Base"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import six
from sklearn.utils import check_random_state
from ..base import Environment
@six.add_metaclass(abc.ABCMeta)
class AgentBase(object):
"""Agent Base Template.
Defines a basic contract shar... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/agents/base.py",
"copies": "1",
"size": "1303",
"license": "mit",
"hash": -135948974581874860,
"line_mean": 24.0576923077,
"line_max": 69,
"alpha_frac": 0.650038373,
"autogenerated": false,
"ratio": 4.23051948051948,
"config_test": fals... |
"""Artificial Agents Test"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import warnings
from unittest import TestCase
from artificial import base, agents
from artificial.base import State
from artificial.searches import fringe
class _S(State):
@property
def is_goal(self):
r... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/agents/tests/agents_test.py",
"copies": "1",
"size": "7158",
"license": "mit",
"hash": 1081405976653463000,
"line_mean": 27.2924901186,
"line_max": 70,
"alpha_frac": 0.5217937972,
"autogenerated": false,
"ratio": 3.6992248062015505,
"co... |
"""Artificial Environment"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import logging
import six
logger = logging.getLogger('artificial')
@six.add_metaclass(abc.ABCMeta)
class Environment(object):
"""Environment Base Class.
Defines how agents and states intertwine, mo... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/base/environment.py",
"copies": "1",
"size": "2911",
"license": "mit",
"hash": 8222140090343056000,
"line_mean": 24.9910714286,
"line_max": 78,
"alpha_frac": 0.6035726554,
"autogenerated": false,
"ratio": 4.555555555555555,
"config_test... |
"""Artificial Fringe Searches"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import six
from . import base
from .. import agents
from ..utils import PriorityQueue
@six.add_metaclass(abc.ABCMeta)
class FringeBase(base.SearchBase):
"""Fringe Base Search.
Base class for se... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/searches/fringe.py",
"copies": "1",
"size": "10008",
"license": "mit",
"hash": 531827173218150100,
"line_mean": 31.1800643087,
"line_max": 79,
"alpha_frac": 0.60931255,
"autogenerated": false,
"ratio": 4.326848249027237,
"config_test": ... |
"""Artificial Genetic Algorithm Tests"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import string
import time
from unittest import TestCase
import numpy as np
from artificial import base, agents
from artificial.searches import genetic
from nose_parameterized import parameterized
random_stat... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/searches/tests/genetic_test.py",
"copies": "1",
"size": "8606",
"license": "mit",
"hash": 7883062666656292,
"line_mean": 32.486381323,
"line_max": 79,
"alpha_frac": 0.5712293749,
"autogenerated": false,
"ratio": 4.072882158069096,
"conf... |
# Artificial Intelligence Homework
# Project: Birds V formation simulation
#
# By: Ryan Gilera
# Date: 16/02/14
#
#import simpleguitk as simplegui
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
import random
import math
#Global Variables
HEIGHT = 600
WIDTH = 900
DISTANCE_BET_BIRDS = 20
SPEED_LIMIT = 20
R... | {
"repo_name": "Daytron/cluster-bird-formation-sim",
"path": "source/birds_sim.py",
"copies": "1",
"size": "11904",
"license": "mit",
"hash": 6803502209951331000,
"line_mean": 33.2068965517,
"line_max": 139,
"alpha_frac": 0.5443548387,
"autogenerated": false,
"ratio": 3.042944785276074,
"config_... |
"""Play a game using the minimax algorithm."""
"""
Mancala game v1.0
Lyndon While, 3 April 2014
The program prompts the user for the game size X, then it plays a
game of Mancala between two random players and creates an SVG file
MancalaGameX.svg
that shows the history of the board during the game. Each board is... | {
"repo_name": "smspillaz/artificial-intelligence",
"path": "artificialintelligence/minimax.py",
"copies": "1",
"size": "8999",
"license": "mit",
"hash": 4949056909668496000,
"line_mean": 32.9622641509,
"line_max": 139,
"alpha_frac": 0.5479497722,
"autogenerated": false,
"ratio": 3.230078966259870... |
#Artificial Intelligence Module for Pygame. Developed by Shreyas Iyer, 2015.
'''
------------------------------------------------------------------------------------------------------------------------
Visit www.github.com/djeof-1 for further updates.
About --> AI module instantiates an AI object, with basic attribu... | {
"repo_name": "djeof-1/Pygame-modules",
"path": "ai.py",
"copies": "1",
"size": "5019",
"license": "mit",
"hash": 2950641978660193000,
"line_mean": 37.9069767442,
"line_max": 217,
"alpha_frac": 0.6359832636,
"autogenerated": false,
"ratio": 2.9368051492100644,
"config_test": false,
"has_no_ke... |
"""Finds a minimum spanning tree for a sparse matrix."""
from collections import namedtuple
class DisjointSet(object):
"""A disjoint set.
This contains a number of subsets of elements. It exposes two main
operations, that being find(), which tells you which set-id an element
resides in, and merge(a,... | {
"repo_name": "smspillaz/artificial-intelligence",
"path": "artificialintelligence/mst.py",
"copies": "1",
"size": "4847",
"license": "mit",
"hash": -3644912785757762600,
"line_mean": 34.1231884058,
"line_max": 79,
"alpha_frac": 0.584897875,
"autogenerated": false,
"ratio": 3.742857142857143,
"... |
"""Loader module."""
from artificialintelligence.mst import minimum_spanning_tree
from collections import namedtuple
import math
MSTNode = namedtuple("MSTNode", "which distance")
TSPNode = namedtuple("TSPNode", "x y")
def _depth_first_search_recurse(current_node, mst_array, traversal, recursion):
"""Expand all... | {
"repo_name": "smspillaz/artificial-intelligence",
"path": "artificialintelligence/tsp_mst.py",
"copies": "1",
"size": "5830",
"license": "mit",
"hash": 3930108494755539000,
"line_mean": 34.3393939394,
"line_max": 83,
"alpha_frac": 0.5638078902,
"autogenerated": false,
"ratio": 3.6392009987515603... |
"""Artificial Local Searches"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import logging
import multiprocessing
import threading
import six
from . import base
from .. import agents
logger = logging.getLogger('artificial')
@six.add_metaclass(abc.ABCMeta)
class Local(base.Searc... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/searches/local.py",
"copies": "1",
"size": "5653",
"license": "mit",
"hash": 8607761631317621000,
"line_mean": 29.722826087,
"line_max": 74,
"alpha_frac": 0.5611179904,
"autogenerated": false,
"ratio": 4.437205651491365,
"config_test": ... |
"""Artificial Local Searches Test"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
from unittest import TestCase
import numpy as np
from artificial import agents, base
from artificial.searches.local import HillClimbing, LocalBeam
random_state = np.random.RandomState(0)
class _TState(base.St... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/searches/tests/local_test.py",
"copies": "1",
"size": "3780",
"license": "mit",
"hash": 8253533682902146000,
"line_mean": 29.24,
"line_max": 76,
"alpha_frac": 0.5997354497,
"autogenerated": false,
"ratio": 3.720472440944882,
"config_tes... |
# Artificially bump priority for these packages.
QMANAGER_PRIORITY_PACKAGES = ""
# Port status codes
PENDING = 1 # Yet to build
PHASE2 = 2 # Failed once
class Package:
def __init__(self, name, path, prefix, comment, descr, maintainer,
cats, www):
__slots__ = ["name", "path", "prefix", "comment"... | {
"repo_name": "flz/portbuild-ng",
"path": "lib/portbuild/package.py",
"copies": "1",
"size": "2940",
"license": "bsd-2-clause",
"hash": -98818582708430270,
"line_mean": 25.017699115,
"line_max": 71,
"alpha_frac": 0.5931972789,
"autogenerated": false,
"ratio": 3.9622641509433962,
"config_test": ... |
#Artificial Neural Network
#includes
import configparser
import math
import matplotlib.pyplot as plt
import numpy as np
import random
from decimal import *
#global variables
weights = [];
topology = [];
data_training = [];
data_test = [];
learning_rate = 0;
weight_min = 0;
weight_max = 0;
error_terms = [];
outputs =... | {
"repo_name": "mishless/LearningSystems",
"path": "a1/ANN.py",
"copies": "1",
"size": "12339",
"license": "mit",
"hash": 835051681647635500,
"line_mean": 30.6384615385,
"line_max": 146,
"alpha_frac": 0.5779236567,
"autogenerated": false,
"ratio": 3.536543422184007,
"config_test": true,
"has_n... |
"""Artificial Searches Base"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import six
from artificial import agents
@six.add_metaclass(abc.ABCMeta)
class SearchBase(object):
"""Search Base Template.
Defines the basic contract shared between search algorithms,
includ... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/searches/base.py",
"copies": "1",
"size": "3321",
"license": "mit",
"hash": 991477915225280000,
"line_mean": 27.6293103448,
"line_max": 79,
"alpha_frac": 0.6067449563,
"autogenerated": false,
"ratio": 4.6840620592383635,
"config_test": ... |
"""Artificial States"""
# Author: Lucas David -- <ld492@drexel.edu>
# License: MIT (c) 2016
import abc
import copy as copy_lib
import six
class State(object):
"""State.
Keeps track of episodic updates in the environment, maintaining
a sequence through a recursive reference to parent states.
A... | {
"repo_name": "lucasdavid/artificial",
"path": "artificial/base/state.py",
"copies": "1",
"size": "5321",
"license": "mit",
"hash": 4986048970346554000,
"line_mean": 26.8586387435,
"line_max": 78,
"alpha_frac": 0.5916181169,
"autogenerated": false,
"ratio": 4.441569282136895,
"config_test": fal... |
# artificialturf - emulation of greenlet using threads
# For performance reasons, this should be rewritten to use Java once expose is available
import sys
import threading
from collections import namedtuple
from java.util.concurrent import ArrayBlockingQueue
class error(Exception):
pass
class GreenletExit(Exc... | {
"repo_name": "jythontools/artificialturf",
"path": "greenlet/__init__.py",
"copies": "1",
"size": "6969",
"license": "apache-2.0",
"hash": -6973187422876367000,
"line_mean": 36.2673796791,
"line_max": 161,
"alpha_frac": 0.6353852777,
"autogenerated": false,
"ratio": 4.3312616532007455,
"config... |
# Artillery Gunner Game
# Chapter 12
# MyLibrary.py
import sys, time, random, math, pygame
from pygame.locals import *
# calculates distance between two points
def distance(point1, point2):
delta_x = point1.x - point2.x
delta_y = point1.y - point2.y
dist = math.sqrt(delta_x * delta_x + delt... | {
"repo_name": "Great-Li-Xin/PythonDev",
"path": "Games/resources/code/chap13/ArtilleryGunnerGame.py",
"copies": "1",
"size": "17013",
"license": "mit",
"hash": -8562866120927651000,
"line_mean": 32.9342915811,
"line_max": 107,
"alpha_frac": 0.5461705754,
"autogenerated": false,
"ratio": 3.6391443... |
artist_name = input("What artist would you like to look up?")
# print ("Hello," + artist_name)
import requests
response = requests.get('https://api.spotify.com/v1/search?query='+ artist_name +'&type=artist&limit=50&market=US&offset=50')
response = response.json()
#print(smallresponse)
#
#print(smallresponse['artist... | {
"repo_name": "M0nica/python-foundations-hw",
"path": "05/SpotifySearch.py",
"copies": "1",
"size": "2589",
"license": "mit",
"hash": -4238733616812453000,
"line_mean": 31.7721518987,
"line_max": 129,
"alpha_frac": 0.6732329085,
"autogenerated": false,
"ratio": 3.1268115942028984,
"config_test"... |
"""Artist puzzles from <http://code.org> built on `tkinter` only.
Artist is similar to the great `turtle` standard module for teaching
programming but builds on a foundation of puzzle and solution, (which
`turtle` does not):
- Subset of basic Python turtle commands (all needed for puzzles).
- Puzzles created by stu... | {
"repo_name": "skilstak/code-dot-org-python",
"path": "codestudio/artist.py",
"copies": "1",
"size": "10452",
"license": "unlicense",
"hash": -303974540282219300,
"line_mean": 29.9230769231,
"line_max": 78,
"alpha_frac": 0.5590317643,
"autogenerated": false,
"ratio": 3.835596330275229,
"config_... |
"""artlaasya admin"""
from django.contrib import admin
from .models import Artist, Genre, Artwork, Event
class ArtistAdmin(admin.ModelAdmin):
ordering = ('last_name', 'first_name',)
search_fields = ('last_name', 'first_name',)
list_display = ('last_name', 'first_name', 'is_active',)
lis... | {
"repo_name": "davidjcox/artlaasya",
"path": "artlaasya/admin.py",
"copies": "1",
"size": "3713",
"license": "bsd-3-clause",
"hash": -1538519036197071400,
"line_mean": 30.5877192982,
"line_max": 80,
"alpha_frac": 0.4874764342,
"autogenerated": false,
"ratio": 3.8717413972888424,
"config_test": ... |
"""artlaasya managers"""
from django.db import models
from django.utils import timezone
from datetime import timedelta
class ArtistQuerySet(models.QuerySet):
DAYS = 30
DATE = timezone.now() - timedelta(days=DAYS)
def related_artwork(self):
return self.select_related('ar... | {
"repo_name": "davidjcox/artlaasya",
"path": "artlaasya/managers.py",
"copies": "1",
"size": "3674",
"license": "bsd-3-clause",
"hash": 8833735151300755000,
"line_mean": 22.5066666667,
"line_max": 71,
"alpha_frac": 0.6121393576,
"autogenerated": false,
"ratio": 4.100446428571429,
"config_test":... |
"""artlaasya menu_tags"""
from django import template
from artlaasya.models import Artist, Artwork, Genre
register = template.Library()
@register.assignment_tag
def get_genres_menu():
'''
Retrieves 'name', and 'slug' of Traditional genres.
'''
return Genre.genres.traditional(
... | {
"repo_name": "davidjcox/artlaasya",
"path": "artlaasya/templatetags/menu_tags.py",
"copies": "1",
"size": "2708",
"license": "bsd-3-clause",
"hash": 7675933790760690000,
"line_mean": 29.511627907,
"line_max": 82,
"alpha_frac": 0.4538404727,
"autogenerated": false,
"ratio": 4.179012345679013,
"... |
"""artlaasya models"""
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse
import os
import string
from datetime import date
import deepzoom.models as deepzoom_models
import artlaasya.managers as artlaasya_managers
from artlaasya.mixins import Mode... | {
"repo_name": "davidjcox/artlaasya",
"path": "artlaasya/models.py",
"copies": "1",
"size": "17288",
"license": "bsd-3-clause",
"hash": -3962760480845819000,
"line_mean": 33.7929606625,
"line_max": 82,
"alpha_frac": 0.4822420176,
"autogenerated": false,
"ratio": 5.049065420560748,
"config_test":... |
'''artlaasya signals'''
from django.dispatch import receiver
from django.db.models.signals import pre_save, post_save, pre_delete
try:
from django.utils.text import slugify
except ImportError:
try:
from django.template.defaultfilters import slugify
except ImportError:
print("Una... | {
"repo_name": "davidjcox/artlaasya",
"path": "artlaasya/signals.py",
"copies": "1",
"size": "7852",
"license": "bsd-3-clause",
"hash": 7641381968289807000,
"line_mean": 35.9323671498,
"line_max": 89,
"alpha_frac": 0.6093988793,
"autogenerated": false,
"ratio": 3.8414872798434443,
"config_test":... |
"""artlaasya views"""
from django.shortcuts import get_object_or_404, get_list_or_404, render_to_response
from django.core.context_processors import csrf
from django.template import RequestContext
from django.views.generic import TemplateView
from django.contrib.sitemaps import Sitemap
from django.conf import settings... | {
"repo_name": "davidjcox/artlaasya",
"path": "artlaasya/views.py",
"copies": "1",
"size": "13818",
"license": "bsd-3-clause",
"hash": 154104018505726720,
"line_mean": 34.7979274611,
"line_max": 85,
"alpha_frac": 0.5141843972,
"autogenerated": false,
"ratio": 4.646267652992602,
"config_test": fa... |
'Artmaking, a tiny demonstration game for Curveship.'
__author__ = 'Nick Montfort'
__copyright__ = 'Copyright 2011 Nick Montfort'
__license__ = 'ISC'
__version__ = '0.5.0.0'
from item_model import Actor, Room, Thing
from action_model import Modify, Sense
import can
import when
discourse = {
'metadata': {
... | {
"repo_name": "lucidbard/curveship",
"path": "fiction/artmaking.py",
"copies": "3",
"size": "2031",
"license": "isc",
"hash": -7257453192477348000,
"line_mean": 29.7727272727,
"line_max": 80,
"alpha_frac": 0.5672082718,
"autogenerated": false,
"ratio": 3.538327526132404,
"config_test": false,
... |
# Art-Net protocol for Pimoroni Unicorn Hat
# Open Pixel Control protocol for Pimoroni Unicorn Hat
# License: MIT
import unicornhat as unicorn
from twisted.internet import protocol, endpoints
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
# Adjust the LED brightness as need... | {
"repo_name": "bbx10/artnet-unicorn-hat",
"path": "artnet-server.py",
"copies": "1",
"size": "5540",
"license": "mit",
"hash": 1174678060999263500,
"line_mean": 39.7352941176,
"line_max": 99,
"alpha_frac": 0.4510830325,
"autogenerated": false,
"ratio": 3.9014084507042255,
"config_test": false,
... |
"""Artnotizen organizes all dated files in a given directory in year/month/day
folders, compiles are markdown files to HTML, and constructs an easy to navigate
single-page index in index.html."""
from collections import OrderedDict
from datetime import datetime
import os
import pipes
import re
import shlex
import subpr... | {
"repo_name": "awblocker/artnotizen",
"path": "src/lib.py",
"copies": "1",
"size": "9213",
"license": "apache-2.0",
"hash": -5894505601621335000,
"line_mean": 34.98828125,
"line_max": 80,
"alpha_frac": 0.6116357321,
"autogenerated": false,
"ratio": 4.042562527424309,
"config_test": false,
"ha... |
"""A RT problem with two distinct modes: short wave length on the
left and long wavelenght on the right. This allows one to see
how the growth rate depends on wavenumber.
"""
from __future__ import print_function
import numpy as np
import sys
import mesh.patch as patch
from util import msg
def init_data(my_data, ... | {
"repo_name": "zingale/pyro2",
"path": "compressible/problems/rt2.py",
"copies": "2",
"size": "2462",
"license": "bsd-3-clause",
"hash": 9092478982521482000,
"line_mean": 26.6629213483,
"line_max": 95,
"alpha_frac": 0.5658001625,
"autogenerated": false,
"ratio": 2.7756482525366404,
"config_test... |
# Author: Peter Hinch
# Copyright Peter Hinch 2017 Released under the MIT license
# Run this to characterise a remote.
# import as_drivers.nec_ir.art
from sys import platform
import uasyncio as asyncio
ESP32 = platform == 'esp32' or platform == 'esp32_LoBo'
if platform == 'pyboard':
from pyb import Pin
elif pla... | {
"repo_name": "peterhinch/micropython-async",
"path": "v3/as_drivers/nec_ir/art.py",
"copies": "1",
"size": "1557",
"license": "mit",
"hash": -2782633328743102000,
"line_mean": 27.8333333333,
"line_max": 81,
"alpha_frac": 0.6377649326,
"autogenerated": false,
"ratio": 3.414473684210526,
"config... |
# Author: Peter Hinch
# Copyright Peter Hinch 2017 Released under the MIT license
# Run this to characterise a remote.
from sys import platform
import uasyncio as asyncio
ESP32 = platform == 'esp32' or platform == 'esp32_LoBo'
if platform == 'pyboard':
from pyb import Pin
elif platform == 'esp8266' or ESP32:
... | {
"repo_name": "peterhinch/micropython-async",
"path": "v2/nec_ir/art.py",
"copies": "1",
"size": "1329",
"license": "mit",
"hash": 8119847627591523000,
"line_mean": 27.2765957447,
"line_max": 78,
"alpha_frac": 0.6380737397,
"autogenerated": false,
"ratio": 3.347607052896725,
"config_test": fals... |
"""art URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | {
"repo_name": "memnonila/art",
"path": "art/urls.py",
"copies": "1",
"size": "1052",
"license": "mit",
"hash": 3722788621007718000,
"line_mean": 39.4615384615,
"line_max": 102,
"alpha_frac": 0.6920152091,
"autogenerated": false,
"ratio": 3.542087542087542,
"config_test": false,
"has_no_keywor... |
"""ArtWorkManager URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | {
"repo_name": "biansetuliao/ArtWorkManager",
"path": "ArtWorkManager/urls.py",
"copies": "1",
"size": "1284",
"license": "mit",
"hash": -1294615595672244200,
"line_mean": 43.275862069,
"line_max": 77,
"alpha_frac": 0.6908099688,
"autogenerated": false,
"ratio": 3.5766016713091924,
"config_test"... |
"""A rudimentary port of the intro video used for the intro animation on
pymunk.org. The code is tested on both Windows and Android.
Note that it doesn't display Kivy best practices, the intro_video
code was just converted to Kivy in the most basic way to show that its possible,
its not supposed to show the best way... | {
"repo_name": "viblo/pymunk",
"path": "examples/kivy_pymunk_demo/main.py",
"copies": "1",
"size": "13128",
"license": "mit",
"hash": 3532567208560812500,
"line_mean": 31.5756823821,
"line_max": 85,
"alpha_frac": 0.5246039001,
"autogenerated": false,
"ratio": 3.301810865191147,
"config_test": fa... |
"""A RuleSet is a set of math rules organized by category.
The actual rules are in the rulesets submodule.
Usage:
- Call begin_rule_set.
- Add topics with add_topic
- Set a default topic order by using set_topic_order.
- Add rules by importing modules which make use of the rule decorator.
- call end_rule_set.
there ... | {
"repo_name": "3mousetech/mathml_accessibility",
"path": "mathml_accessibility/rule_set.py",
"copies": "1",
"size": "5221",
"license": "mpl-2.0",
"hash": 7967967802982255000,
"line_mean": 29.7117647059,
"line_max": 122,
"alpha_frac": 0.7186362766,
"autogenerated": false,
"ratio": 3.07660577489687... |
# A run is a sequence of adjacent repeated values. Write a program that prints the
# runs by including them in parentheses, like this:
# 1 2 (5 5) 3 1 2 4 3 (2 2 2 2) 3 6 (5 5) 6 3 1
#
# Use the following pseudocode:
# Set a boolean variable inRun to false.
# For each valid index i in the list
# I... | {
"repo_name": "futurepr0n/Books-solutions",
"path": "Python-For-Everyone-Horstmann/Chapter6-Lists/P6.14.py",
"copies": "1",
"size": "1313",
"license": "mit",
"hash": 3385202291786896000,
"line_mean": 25.8163265306,
"line_max": 82,
"alpha_frac": 0.4851485149,
"autogenerated": false,
"ratio": 3.419... |
"""A run loop for agent/environment interaction."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
def run_loop(agents, env, max_frames=0):
"""A run loop to have agents and an environment interact."""
total_frames = 0
start_time = time.... | {
"repo_name": "sino30535/pysc2_simple64_agent",
"path": "run_loop_m.py",
"copies": "1",
"size": "1108",
"license": "apache-2.0",
"hash": 3715218716718686700,
"line_mean": 26.7,
"line_max": 65,
"alpha_frac": 0.6326714801,
"autogenerated": false,
"ratio": 3.820689655172414,
"config_test": false,
... |
"""Arun Microelectronics Ltd. gauge drivers
Driver for Arun Microelectronics Ltd. (AML) gauges according to the
manual of an NGC2D instrument, the driver should also support PGC1
instruments.
"""
import unittest
import pyhard2.driver as drv
Cmd, Access = drv.Command, drv.Access
def _parse_stat_byte(stat):
"""Pa... | {
"repo_name": "Synss/pyhard2",
"path": "pyhard2/driver/aml.py",
"copies": "1",
"size": "3605",
"license": "mit",
"hash": -59354821380886040,
"line_mean": 26.9457364341,
"line_max": 72,
"alpha_frac": 0.5600554785,
"autogenerated": false,
"ratio": 3.534313725490196,
"config_test": true,
"has_no... |
"""A runner outputing logits or normalized distriution from a decoder."""
from typing import Dict, List, Any
# pylint: disable=unused-import
from typing import Optional
# pylint: enable=unused-import
from typeguard import check_argument_types
import numpy as np
import tensorflow as tf
from neuralmonkey.runners.base_... | {
"repo_name": "bastings/neuralmonkey",
"path": "neuralmonkey/runners/logits_runner.py",
"copies": "1",
"size": "5409",
"license": "bsd-3-clause",
"hash": 5557953466234584000,
"line_mean": 37.3617021277,
"line_max": 79,
"alpha_frac": 0.570160843,
"autogenerated": false,
"ratio": 4.580016934801016,... |
"""A runner outputing logits or normalized distriution from a decoder."""
from typing import Dict, List, Optional
from typeguard import check_argument_types
import numpy as np
import tensorflow as tf
from neuralmonkey.decoders.classifier import Classifier
from neuralmonkey.decorators import tensor
from neuralmonkey.... | {
"repo_name": "ufal/neuralmonkey",
"path": "neuralmonkey/runners/logits_runner.py",
"copies": "1",
"size": "4188",
"license": "bsd-3-clause",
"hash": -2792838528841022500,
"line_mean": 38.8857142857,
"line_max": 79,
"alpha_frac": 0.5768863419,
"autogenerated": false,
"ratio": 4.61742006615215,
... |
"""A runner outputing logits or normalized distriution from a decoder."""
from typing import Dict, List, Set, Optional
from typeguard import check_argument_types
import numpy as np
import tensorflow as tf
from neuralmonkey.decoders.classifier import Classifier
from neuralmonkey.runners.base_runner import (
BaseR... | {
"repo_name": "juliakreutzer/bandit-neuralmonkey",
"path": "neuralmonkey/runners/logits_runner.py",
"copies": "1",
"size": "5368",
"license": "bsd-3-clause",
"hash": 6776460654924637000,
"line_mean": 37.0709219858,
"line_max": 79,
"alpha_frac": 0.5890461997,
"autogenerated": false,
"ratio": 4.480... |
"""A runner that prints out the input representation from an encoder."""
# pylint: disable=unused-import
from typing import Dict, List, Optional
# pylint: enable=unused-import
import tensorflow as tf
from neuralmonkey.model.model_part import ModelPart
from neuralmonkey.runners.base_runner import (BaseRunner, Executa... | {
"repo_name": "bastings/neuralmonkey",
"path": "neuralmonkey/runners/representation_runner.py",
"copies": "1",
"size": "2640",
"license": "bsd-3-clause",
"hash": 3695164450978232000,
"line_mean": 33.7368421053,
"line_max": 77,
"alpha_frac": 0.5875,
"autogenerated": false,
"ratio": 4.7311827956989... |
"""arXiv docstring to be inserted here."""
from feedparser import parse
from arxiv2bib import Cli
from engine import Engine
from result import Result
class ArxivResult(Result):
"""arXiv Result Parser"""
def get_title(self):
"""Return the publication title"""
try:
return self... | {
"repo_name": "dimalik/pyopl",
"path": "pyopl/engines/arxiv.py",
"copies": "1",
"size": "2021",
"license": "bsd-3-clause",
"hash": -2739419853610217500,
"line_mean": 29.1641791045,
"line_max": 77,
"alpha_frac": 0.5853537853,
"autogenerated": false,
"ratio": 4.042,
"config_test": false,
"has_n... |
# a safe tracking script - servos are created seperately
# and their limits are programmed, they are then "bound" to
# the tracking service
tracker = Runtime.create("tracker","Tracking")
# create servos BEFORE starting the tracking service
# so we can specify values for the servos and specify names
# before it starts... | {
"repo_name": "sstocker46/pyrobotlab",
"path": "home/Alessandruino/Tracking.safe.modified.worky.py",
"copies": "5",
"size": "1615",
"license": "apache-2.0",
"hash": -1108815517122421500,
"line_mean": 30.0576923077,
"line_max": 72,
"alpha_frac": 0.7578947368,
"autogenerated": false,
"ratio": 3.275... |
"""A sample app that operates on GCS files with blobstore API."""
import cloudstorage
from google.appengine.api import app_identity
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
import webapp2
# This handler creates a file in Cloud Storage using the cloudstorag... | {
"repo_name": "sharbison3/python-docs-samples",
"path": "appengine/standard/blobstore/gcs/main.py",
"copies": "8",
"size": "3203",
"license": "apache-2.0",
"hash": -6226446186858241000,
"line_mean": 41.1447368421,
"line_max": 79,
"alpha_frac": 0.6912269747,
"autogenerated": false,
"ratio": 4.2367... |
"""A sample app that operates on GCS files with blobstore API's BlobReader."""
import cloudstorage
from google.appengine.api import app_identity
from google.appengine.ext import blobstore
import webapp2
class BlobreaderHandler(webapp2.RequestHandler):
def get(self):
# Get the default Cloud Storage Bucket... | {
"repo_name": "canglade/NLP",
"path": "appengine/standard/blobstore/blobreader/main.py",
"copies": "8",
"size": "2738",
"license": "apache-2.0",
"hash": 2486095787091167000,
"line_mean": 38.6811594203,
"line_max": 78,
"alpha_frac": 0.661431702,
"autogenerated": false,
"ratio": 4.074404761904762,
... |
# A sample Clever Instant Login implementation.
# Uses the Bottle framework and raw HTTP requests to demonstrate the OAuth2 flow.
import base64
import json
import os
import requests
import urllib
from bottle import app, redirect, request, route, run, template
from beaker.middleware import SessionMiddleware
# Obtain ... | {
"repo_name": "kurtmansperger/Clever-Instant-Login-Python",
"path": "server.py",
"copies": "1",
"size": "4771",
"license": "mit",
"hash": 3626269856689339000,
"line_mean": 34.6044776119,
"line_max": 122,
"alpha_frac": 0.6491301614,
"autogenerated": false,
"ratio": 3.792527821939587,
"config_tes... |
"""A sample client for the OpenBCI UDP server."""
from __future__ import print_function
import argparse
try:
import cPickle as pickle
except ImportError:
import _pickle as pickle
import json
import sys
sys.path.append('..') # help python find cyton.py relative to scripts folder
import socket
parser = argpa... | {
"repo_name": "OpenBCI/OpenBCI_Python",
"path": "scripts/udp_client.py",
"copies": "1",
"size": "1622",
"license": "mit",
"hash": 4980071161417001000,
"line_mean": 26.0333333333,
"line_max": 77,
"alpha_frac": 0.6066584464,
"autogenerated": false,
"ratio": 3.965770171149144,
"config_test": false... |
"""A sample client for the OpenBCI UDP server."""
import argparse
import cPickle as pickle
import json
import sys;
sys.path.append(
'..') # help python find open_bci_v3.py relative to scripts folder
import open_bci_v3 as open_bci
import socket
parser = argparse.ArgumentParser(
description='Run a UDP client ... | {
"repo_name": "neurotechuoft/Wall-EEG",
"path": "Code/OpenBCIPy/src/scripts/udp_client.py",
"copies": "1",
"size": "1564",
"license": "mit",
"hash": 8856808865530988000,
"line_mean": 26.9285714286,
"line_max": 73,
"alpha_frac": 0.6029411765,
"autogenerated": false,
"ratio": 3.890547263681592,
"... |
# A sample context menu handler.
# Adds a 'Hello from Python' menu entry to .py files. When clicked, a
# simple message box is displayed.
#
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer, and browse to a directory with a .py file.
# * Right-Click on a .py file - locate... | {
"repo_name": "ArcherSys/ArcherSys",
"path": "Lib/site-packages/win32comext/shell/demos/servers/context_menu.py",
"copies": "10",
"size": "4442",
"license": "mit",
"hash": 9210508973588832000,
"line_mean": 41.3047619048,
"line_max": 90,
"alpha_frac": 0.6193156236,
"autogenerated": false,
"ratio":... |
# A sample context menu handler.
# Adds a menu item with sub menu to all files and folders, different options inside specified folder.
# When clicked a list of selected items is displayed.
#
# To demostrate:
# * Execute this script to register the context menu. `python context_menu.py --register`
# * Restart explorer.... | {
"repo_name": "geekpradd/Sorty",
"path": "context.py",
"copies": "1",
"size": "7153",
"license": "mit",
"hash": 8839989323853974000,
"line_mean": 40.3526011561,
"line_max": 120,
"alpha_frac": 0.660562002,
"autogenerated": false,
"ratio": 3.3440860215053765,
"config_test": false,
"has_no_keywo... |
# A sample context menu handler.
# Adds a 'Hello from Python' menu entry to .py files. When clicked, a
# simple message box is displayed.
#
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer, and browse to a directory with a .py file.
# * Right-Click on a .py file -... | {
"repo_name": "zhanqxun/cv_fish",
"path": "win32comext/shell/demos/servers/context_menu.py",
"copies": "4",
"size": "4546",
"license": "apache-2.0",
"hash": -5307188589560985000,
"line_mean": 41.2952380952,
"line_max": 90,
"alpha_frac": 0.6047074351,
"autogenerated": false,
"ratio": 3.75082508250... |
"""A sample custom HTTP server."""
import functools
import html
import traceback
import collect
import server
server.Logger.name = __file__
HTML_TMPL = '''\
<html>
<head>
<link rel="stylesheet" type="text/css" href="/myStyle.css"/>
</head>
<body id="consolas">
%s</body>
</html>
'''
LINK_HOME = '<a href="/">Home<... | {
"repo_name": "cheeseywhiz/cheeseywhiz",
"path": "socket/app.py",
"copies": "1",
"size": "3395",
"license": "mit",
"hash": -5685612508731616000,
"line_mean": 20.9032258065,
"line_max": 73,
"alpha_frac": 0.5902798233,
"autogenerated": false,
"ratio": 3.334970530451866,
"config_test": false,
"h... |
## A sample file for one hot encoding code ##
## Use with your different classifiers ##
import numpy as np
import pandas as pd
import time
from sklearn.preprocessing import OneHotEncoder
# Non feature
NON_FEATURE=['activity_id','people_id','date','people_date']
# Categorical data that is only label encoded
CATEGORIC... | {
"repo_name": "BhavyaLight/kaggle-predicting-Red-Hat-Business-Value",
"path": "Initial_Classification_Models/one_hot_encoding_sample.py",
"copies": "1",
"size": "3544",
"license": "mit",
"hash": 532197132085245760,
"line_mean": 42.2317073171,
"line_max": 115,
"alpha_frac": 0.638261851,
"autogenerat... |
# a sample graph
graph = {'A': ['B', 'C','E'],
'B': ['A','C', 'D'],
'C': ['D'],
'D': ['C'],
'E': ['F','D'],
'F': ['C']}
graph2 = {'A': ['B', 'C'],
'B': [ 'D'],
'C': ['E'],
'D': ['F'],
'E': [],
... | {
"repo_name": "quake0day/oj",
"path": "checkloop.py",
"copies": "1",
"size": "1566",
"license": "mit",
"hash": 7402504270148030000,
"line_mean": 23.46875,
"line_max": 51,
"alpha_frac": 0.4118773946,
"autogenerated": false,
"ratio": 3.3896103896103895,
"config_test": false,
"has_no_keywords": ... |
# a sample graph
graph = {'A': ['B', 'C','E'],
'B': ['A','C', 'D'],
'C': ['D'],
'D': ['C'],
'E': ['F','D'],
'F': ['C']}
class MyQUEUE: # just an implementation of a queue
def __init__(self):
self.holder = []
def enqueue(self,val):
... | {
"repo_name": "martindavid/code-sandbox",
"path": "algorithm/COMP90038/comp90038-assignment1/Test.py",
"copies": "1",
"size": "1450",
"license": "mit",
"hash": -5098249885432630000,
"line_mean": 22.4032258065,
"line_max": 54,
"alpha_frac": 0.4351724138,
"autogenerated": false,
"ratio": 3.43601895... |
### a sample graph
##graph = {'A': ['B', 'C','E'],
## 'B': ['A','C', 'D'],
## 'C': ['D'],
## 'D': ['C'],
## 'E': ['D'],
## 'F': []}
fp = open('taxem.gdf')
text=fp.read()
pl=text.split('\n')
#print(p1)
flag=0
V=[]
graph={}
flag=0
for each_line in... | {
"repo_name": "amudalab/concept-graphs",
"path": "document retrieval/edge_enhancement.py",
"copies": "1",
"size": "3212",
"license": "mit",
"hash": -2325528783674935000,
"line_mean": 23.696,
"line_max": 84,
"alpha_frac": 0.4436488169,
"autogenerated": false,
"ratio": 3.0707456978967493,
"config... |
# A sample icon handler. Sets the icon for Python files to a random
# ICO file. ICO files are found in the Python directory - generally there will
# be 3 icons found.
#
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer, and browse to a directory with a .py file.
# * Note... | {
"repo_name": "SublimeText/Pywin32",
"path": "lib/x32/win32comext/shell/demos/servers/icon_handler.py",
"copies": "10",
"size": "2600",
"license": "bsd-3-clause",
"hash": 8324274229896413000,
"line_mean": 36.1428571429,
"line_max": 81,
"alpha_frac": 0.6823076923,
"autogenerated": false,
"ratio": ... |
# A sample implementation of IEmptyVolumeCache - see
# http://msdn2.microsoft.com/en-us/library/aa969271.aspx for an overview.
#
# * Execute this script to register the handler
# * Start the "disk cleanup" tool - look for "pywin32 compiled files"
import sys, os, stat, time
import pythoncom
from win32com.shell import sh... | {
"repo_name": "int19h/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32comext/shell/demos/servers/empty_volume_cache.py",
"copies": "10",
"size": "7884",
"license": "apache-2.0",
"hash": -1372622822476554500,
"line_mean": 44.8372093023,
"line_max": 93,
"alpha_frac": 0.61... |
"""A sample involving creation of persistent tables
"""
import os
from blaze import Table, fromiter, mean, std, params, open
from random import random
def build_table(table_name, rows):
"""build the table to use in our example.
if already built just open it"""
if not os.path.exists(table_name):
d... | {
"repo_name": "seibert/blaze-core",
"path": "samples/persist_example.py",
"copies": "1",
"size": "1296",
"license": "bsd-2-clause",
"hash": -4092616498115994600,
"line_mean": 20.9661016949,
"line_max": 58,
"alpha_frac": 0.5825617284,
"autogenerated": false,
"ratio": 3.2238805970149254,
"config_... |
"""A sample job that prints string."""
import sys
import os.path
os.environ['NDSCHEDULER_SETTINGS_MODULE'] = 'settings_sched'
addpath = os.path.abspath("./ndscheduler")
if addpath not in sys.path:
sys.path.append(os.path.abspath("./ndscheduler"))
from ndscheduler.corescheduler import job
import WebMirror.TimedTrig... | {
"repo_name": "fake-name/ReadableWebProxy",
"path": "scheduled_jobs/python_job.py",
"copies": "1",
"size": "4739",
"license": "bsd-3-clause",
"hash": 3848232585909021700,
"line_mean": 31.0202702703,
"line_max": 161,
"alpha_frac": 0.7938383625,
"autogenerated": false,
"ratio": 3.047588424437299,
... |
# A sample of using Vista's IExplorerBrowser interfaces...
# Currently doesn't quite work:
# * CPU sits at 100% while running.
import pythoncom
from win32com.shell import shell, shellcon
import win32gui, win32con, win32api
from win32com.server.util import wrap, unwrap
# event handler for the browser.
IExplorerBrowser... | {
"repo_name": "espadrine/opera",
"path": "chromium/src/third_party/python_26/Lib/site-packages/win32comext/shell/demos/explorer_browser.py",
"copies": "17",
"size": "3409",
"license": "bsd-3-clause",
"hash": 3744942420593854000,
"line_mean": 36.8777777778,
"line_max": 127,
"alpha_frac": 0.6456438838,... |
# A sample of using Vista's IExplorerBrowser interfaces...
# Currently doesn't quite work:
# * CPU sits at 100% while running.
import sys
import pythoncom
from win32com.shell import shell, shellcon
import win32gui, win32con, win32api
from win32com.server.util import wrap, unwrap
# event handler for the browser.
IExpl... | {
"repo_name": "int19h/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32comext/shell/demos/explorer_browser.py",
"copies": "10",
"size": "4758",
"license": "apache-2.0",
"hash": -393237709399099460,
"line_mean": 39.6666666667,
"line_max": 127,
"alpha_frac": 0.6277847835,
... |
# A sample of using Vista's IExplorerBrowser interfaces...
# Currently doesn't quite work:
# * CPU sits at 100% while running.
import sys
import pythoncom
from win32com.shell import shell, shellcon
import win32gui, win32con, win32api
from win32com.server.util import wrap, unwrap
# event handler for the brow... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32comext/shell/demos/explorer_browser.py",
"copies": "4",
"size": "4864",
"license": "bsd-3-clause",
"hash": -7940918099554217000,
"line_mean": 39.5726495726,
"line_max": 127,
"alpha_frac": 0.6136924342,
"autogenerated": false,
"... |
# A sample originally provided by Richard Bell, and modified by Mark Hammond.
# This sample demonstrates how to use COM events in a free-threaded world.
# In this world, there is no need to marshall calls across threads, so
# no message loops are needed at all. This means regular cross-thread
# sychronization can be... | {
"repo_name": "SublimeText/Pywin32",
"path": "lib/x64/win32com/demos/eventsFreeThreaded.py",
"copies": "10",
"size": "3527",
"license": "bsd-3-clause",
"hash": 6423254590164878000,
"line_mean": 39.0795454545,
"line_max": 77,
"alpha_frac": 0.7039977318,
"autogenerated": false,
"ratio": 3.936383928... |
# A sample originally provided by Richard Bell, and modified by Mark Hammond.
# This sample demonstrates how to use COM events in an aparment-threaded
# world. In this world, COM itself ensures that all calls to and events
# from an object happen on the same thread that created the object, even
# if they originated f... | {
"repo_name": "sserrot/champion_relationships",
"path": "venv/Lib/site-packages/win32com/demos/eventsApartmentThreaded.py",
"copies": "10",
"size": "3752",
"license": "mit",
"hash": -326962401108284600,
"line_mean": 38.914893617,
"line_max": 79,
"alpha_frac": 0.6876332623,
"autogenerated": false,
... |
# A sample originally provided by Richard Bell, and modified by Mark Hammond.
# This sample demonstrates how to use COM events in a free-threaded world.
# In this world, there is no need to marshall calls across threads, so
# no message loops are needed at all. This means regular cross-thread
# sychronization c... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32com/demos/eventsFreeThreaded.py",
"copies": "4",
"size": "3606",
"license": "bsd-3-clause",
"hash": -4151818755322583000,
"line_mean": 38.9772727273,
"line_max": 77,
"alpha_frac": 0.6880199667,
"autogenerated": false,
"ratio": ... |
# A sample originally provided by Richard Bell, and modified by Mark Hammond.
# This sample demonstrates how to use COM events in an aparment-threaded
# world. In this world, COM itself ensures that all calls to and events
# from an object happen on the same thread that created the object, even
# if they origina... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32com/demos/eventsApartmentThreaded.py",
"copies": "4",
"size": "3838",
"license": "bsd-3-clause",
"hash": -2874611046484132400,
"line_mean": 38.829787234,
"line_max": 79,
"alpha_frac": 0.6717040125,
"autogenerated": false,
"rati... |
"""A sample script module for ScriptWdg.ScriptModuleWdg.
Counts up to a user-specified number with a user-specified
delay between each count.
The widgets that can be adjusted to control script behavior
while the script runs (a very good idea when offering widgets).
History:
2004-06-30 Rowen
"""
import RO.Wdg
def in... | {
"repo_name": "r-owen/stui",
"path": "TUI/Base/Wdg/TestScriptWdg.py",
"copies": "1",
"size": "1502",
"license": "bsd-3-clause",
"hash": -3928714615267388400,
"line_mean": 26.8148148148,
"line_max": 63,
"alpha_frac": 0.6358189081,
"autogenerated": false,
"ratio": 3.6723716381418092,
"config_test... |
""" A sample script to try out coarse-graining in dimension 16
down to dimension 4. Feel free to run, modify, and take
snippets of it to use for other things!
Author: Olivia Di Matteo, 2017
"""
from pynitefields import *
from balthasar import *
import numpy as np
from math import sqrt
# Generate the fi... | {
"repo_name": "glassnotes/Balthasar",
"path": "scripts/dim16.py",
"copies": "1",
"size": "1368",
"license": "bsd-3-clause",
"hash": -2578045299374809600,
"line_mean": 23.8727272727,
"line_max": 72,
"alpha_frac": 0.6915204678,
"autogenerated": false,
"ratio": 2.5958254269449714,
"config_test": f... |
""" A sample script to try out coarse-graining in dimension 256
down to dimension 16. Feel free to run, modify, and take
snippets of it to use for other things!
As dimension 256 is rather large, we show here an example
where we do not compute the full MUB matrix table or
values of any Wigner func... | {
"repo_name": "glassnotes/Balthasar",
"path": "scripts/dim256.py",
"copies": "1",
"size": "1735",
"license": "bsd-3-clause",
"hash": 3244013891544819000,
"line_mean": 34.4081632653,
"line_max": 73,
"alpha_frac": 0.725648415,
"autogenerated": false,
"ratio": 3.2674199623352167,
"config_test": fa... |
""" A sample script to try out coarse-graining in dimension 9
down to dimension 3. Feel free to run, modify, and take
snippets of it to use for other things!
Qudit coarse-graining currently works with a few hiccups
in terms of the plotting. I'll work on fixing these
eventually, but the mechanics o... | {
"repo_name": "glassnotes/Balthasar",
"path": "scripts/dim9.py",
"copies": "1",
"size": "1414",
"license": "bsd-3-clause",
"hash": 8175881246309898000,
"line_mean": 25.1851851852,
"line_max": 71,
"alpha_frac": 0.7171145686,
"autogenerated": false,
"ratio": 2.8336673346693386,
"config_test": fal... |
# A sample shell column provider
# Mainly ported from MSDN article:
# Using Shell Column Handlers for Detailed File Information,
# Raymond Chen, Microsoft Corporation, February 2000
#
# To demostrate:
# * Execute this script to register the namespace.
# * Open Windows Explorer
# * Right-click an explorer column head... | {
"repo_name": "SublimeText/Pywin32",
"path": "lib/x64/win32comext/shell/demos/servers/column_provider.py",
"copies": "10",
"size": "3883",
"license": "bsd-3-clause",
"hash": 2189172933603060500,
"line_mean": 35.980952381,
"line_max": 77,
"alpha_frac": 0.5804790111,
"autogenerated": false,
"ratio"... |
# A sample shell copy hook.
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer
# * Attempt to move or copy a directory.
# * Note our hook's dialog is displayed.
import sys, os
import pythoncom
from win32com.shell import shell, shellcon
import win32gui
import win32con
impor... | {
"repo_name": "zooba/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32comext/shell/demos/servers/copy_hook.py",
"copies": "10",
"size": "2881",
"license": "apache-2.0",
"hash": 4430032873111504400,
"line_mean": 39.5774647887,
"line_max": 157,
"alpha_frac": 0.6282540784,
... |
# A sample shell namespace view
# To demostrate:
# * Execute this script to register the namespace.
# * Open Windows Explorer, and locate the new "Python Path Shell Browser"
# folder off "My Computer"
# * Browse this tree - .py files are shown expandable, with classes and
# methods selectable. Selecting a Python ... | {
"repo_name": "huguesv/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32comext/shell/demos/servers/shell_view.py",
"copies": "10",
"size": "37808",
"license": "apache-2.0",
"hash": 2170263165842384100,
"line_mean": 43.3235638921,
"line_max": 120,
"alpha_frac": 0.58447947... |
# A sample shell namespace view
# To demostrate:
# * Execute this script to register the namespace.
# * Open Windows Explorer, and locate the new "Python Path Shell Browser"
# folder off "My Computer"
# * Browse this tree - .py files are shown expandable, with classes and
# methods selectable. Selecting a ... | {
"repo_name": "ntuecon/server",
"path": "pyenv/Lib/site-packages/win32comext/shell/demos/servers/shell_view.py",
"copies": "4",
"size": "38597",
"license": "bsd-3-clause",
"hash": 492079119250081300,
"line_mean": 43.3016431925,
"line_max": 120,
"alpha_frac": 0.5717024639,
"autogenerated": false,
... |
"""A sample socket server and client using SSPI authentication and encryption.
You must run with either 'client' or 'server' as arguments. A server must be
running before a client can connect.
To use with Kerberos you should include in the client options
--target-spn=username, where 'username' is the user under whic... | {
"repo_name": "huguesv/PTVS",
"path": "Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32/Demos/security/sspi/socket_server.py",
"copies": "6",
"size": "6331",
"license": "apache-2.0",
"hash": -2615661431223653400,
"line_mean": 34.5674157303,
"line_max": 86,
"alpha_frac": 0.5899541937,
... |
"""A sandbox layer that ensures unsafe operations cannot be performed.
Useful when the template itself comes from an untrusted source.
"""
import operator
import types
from _string import formatter_field_name_split # type: ignore
from collections import abc
from collections import deque
from string import Formatter
fr... | {
"repo_name": "mitsuhiko/jinja2",
"path": "src/jinja2/sandbox.py",
"copies": "3",
"size": "14590",
"license": "bsd-3-clause",
"hash": 8760527259261118000,
"line_mean": 33.6555819477,
"line_max": 88,
"alpha_frac": 0.6120630569,
"autogenerated": false,
"ratio": 4.414523449319213,
"config_test": f... |
"""A sandbox layer that ensures unsafe operations cannot be performed.
Useful when the template itself comes from an untrusted source.
"""
import operator
import types
import typing as t
from _string import formatter_field_name_split # type: ignore
from collections import abc
from collections import deque
from string ... | {
"repo_name": "pallets/jinja",
"path": "src/jinja2/sandbox.py",
"copies": "1",
"size": "14600",
"license": "bsd-3-clause",
"hash": 8450062638735576000,
"line_mean": 33.1121495327,
"line_max": 88,
"alpha_frac": 0.5996575342,
"autogenerated": false,
"ratio": 4.199022145527754,
"config_test": fals... |
# A sandpile is a square matrix of natural numbers between 0 and 3,
# representing how many grains of sand there is on each square. To add two
# sandpiles, just start by adding the two matrices element by element. Except
# the matrix you generate might not be a sandpile, if one of its element is
# higher than 3 yo... | {
"repo_name": "Pouf/CodingCompetition",
"path": "CG/community_sandpile-addition.py",
"copies": "1",
"size": "1347",
"license": "mit",
"hash": 3485347989170768000,
"line_mean": 34.4594594595,
"line_max": 79,
"alpha_frac": 0.5909428359,
"autogenerated": false,
"ratio": 3.068337129840547,
"config_... |
"""As an optional feature, we can try to keep track of the assets used. This
makes it easier to run a manual rebuild.
In the future, it can also help deciding when an asset needs an automatic
update. For instance:
- We might auto update when the hash changes, wheras the old hash to
compare against will... | {
"repo_name": "maxcutler/Courant-News",
"path": "courant/core/assets/tracker.py",
"copies": "1",
"size": "1912",
"license": "bsd-3-clause",
"hash": -3546514615250589000,
"line_mean": 34.0754716981,
"line_max": 76,
"alpha_frac": 0.6480125523,
"autogenerated": false,
"ratio": 4.3752860411899315,
... |
"""Asap module Collector.
Defines a filter collecting all information about parallel atoms on the master.
"""
import asap3
import numpy as np
class Collector:
"Atoms-like filter collecting information on the master node."
def __init__(self, atoms, master=None):
self.atoms = atoms
self.comm =... | {
"repo_name": "auag92/n2dm",
"path": "Asap-3.8.4/Python/asap3/Internal/Collector.py",
"copies": "1",
"size": "3941",
"license": "mit",
"hash": 3258346386822080000,
"line_mean": 30.0393700787,
"line_max": 84,
"alpha_frac": 0.5724435422,
"autogenerated": false,
"ratio": 3.8713163064833007,
"confi... |
"""Asap module ParallelListOfAtoms.
Defines the parallel list of atoms object (`ParallelAtoms`), and a factory
method for creating them (`MakeParallelAtoms`).
Importing this module also installs a Python exit function causing
MPI_Abort to be called if an uncaught exception occurs.
"""
__docformat__ = "restructuredt... | {
"repo_name": "auag92/n2dm",
"path": "Asap-3.8.4/Python/asap3/Internal/ParallelListOfAtoms.py",
"copies": "1",
"size": "11264",
"license": "mit",
"hash": 6657647467417787000,
"line_mean": 34.7587301587,
"line_max": 92,
"alpha_frac": 0.5886008523,
"autogenerated": false,
"ratio": 3.874785001719986... |
"""Asap utility functions
This module defines the following functions:
PrintVersion
"""
__docformat__ = "restructuredtext en"
from asap3.Internal.Builtins import _asap, get_version, get_short_version
from asap3 import __file__ as _asapfile
import ase
import sys
import os
def print_version(level = 0):
"""Print ... | {
"repo_name": "auag92/n2dm",
"path": "Asap-3.8.4/Python/asap3/Internal/UtilityFunctions.py",
"copies": "1",
"size": "3989",
"license": "mit",
"hash": -36163814213309500,
"line_mean": 30.912,
"line_max": 100,
"alpha_frac": 0.5968914515,
"autogenerated": false,
"ratio": 3.486888111888112,
"config... |
# As a simple demo of pure functional programming,
# let's do some math using only functions
# We encode numbers so that a number `n`
# is the following function, lambda f: lambda x: f^n(x),
# where f is a function, and x is some value
# `zero` would apply f to x zero times, so would just return x
zero = lambda f: l... | {
"repo_name": "joshbohde/functional_python",
"path": "church.py",
"copies": "1",
"size": "1749",
"license": "bsd-3-clause",
"hash": -2412475290551750000,
"line_mean": 29.1551724138,
"line_max": 71,
"alpha_frac": 0.6935391652,
"autogenerated": false,
"ratio": 3.0155172413793103,
"config_test": f... |
# As a test suite for the os module, this is woefully inadequate, but this
# does add tests for a few functions which have been determined to be more
# portable than they had been thought to be.
import asynchat
import asyncore
import codecs
import contextlib
import decimal
import errno
import fractions
import itertool... | {
"repo_name": "moto-timo/ironpython3",
"path": "Src/StdLib/Lib/test/test_os.py",
"copies": "3",
"size": "98383",
"license": "apache-2.0",
"hash": 5681176939369943000,
"line_mean": 36.3370018975,
"line_max": 101,
"alpha_frac": 0.5746724536,
"autogenerated": false,
"ratio": 3.827238776939236,
"co... |
ASC = 'asc'
DESC = 'desc'
class ColumnURL(object):
"""
Represents the url a column's data should point to.
:params
url - The reversible namespace / name combination for the
relevant view
args - A LIST of arguments to pass (even if there's just one),
all of which correspon... | {
"repo_name": "SheepDogInc/sheepdog_tables",
"path": "sheepdog_tables/column.py",
"copies": "1",
"size": "5675",
"license": "bsd-3-clause",
"hash": -7645091137704419000,
"line_mean": 33.6036585366,
"line_max": 79,
"alpha_frac": 0.5874889868,
"autogenerated": false,
"ratio": 4.486166007905139,
"... |
"""A scatter plot example using Highcharts"""
from itertools import chain
import numpy as np
from Orange.data import Table
from Orange.widgets import gui, settings, widget, highcharts
class Scatterplot(highcharts.Highchart):
"""
Scatterplot extends Highchart and just defines some sane defaults:
* enabl... | {
"repo_name": "qPCR4vir/orange3",
"path": "doc/development/source/code/owScatterplot.py",
"copies": "5",
"size": "8606",
"license": "bsd-2-clause",
"hash": -8616552769513734000,
"line_mean": 37.7567567568,
"line_max": 79,
"alpha_frac": 0.5678754068,
"autogenerated": false,
"ratio": 4.336693548387... |
"""A scenario featuring parametrized tests.
"""
import pytest
def test_multiple(ctestdir):
ctestdir.makepyfile("""
import pytest
_md = pytest.mark.dependency
@pytest.mark.parametrize("x,y", [
pytest.param(0, 0, marks=_md(name="a1")),
pytest.param(0, 1, marks=_md(... | {
"repo_name": "RKrahl/pytest-dependency",
"path": "tests/test_03_param.py",
"copies": "1",
"size": "2044",
"license": "apache-2.0",
"hash": 8803762835841109000,
"line_mean": 34.8596491228,
"line_max": 78,
"alpha_frac": 0.4657534247,
"autogenerated": false,
"ratio": 2.9367816091954024,
"config_t... |
"""Ascending recurrence algorithms for spherical Bessel functions.
The recurrence relation used is http://dlmf.nist.gov/10.51.E1 .
"""
import numpy as np
from scipy.misc import factorial, factorial2
def recurrence_pattern(n, z, f0, f1):
"""Ascending recurrence for jn, yn, h1n, h2n."""
s0 = f0
if n == 0:... | {
"repo_name": "tpudlik/sbf",
"path": "algos/a_recur.py",
"copies": "1",
"size": "2634",
"license": "mit",
"hash": 2211320959727777000,
"line_mean": 26.1546391753,
"line_max": 71,
"alpha_frac": 0.4677296887,
"autogenerated": false,
"ratio": 2.7961783439490446,
"config_test": false,
"has_no_key... |
"""A `SceneEditor` for the `SceneModel`.
"""
# Authors: Prabhu Ramachandran <prabhu [at] aero.iitb.ac.in>
# Robert Kern <robert.kern [at] gmail.com>
#
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
import os
from pyface.qt import QtGui
# Enthought library imports.
from traits.api import Any, B... | {
"repo_name": "liulion/mayavi",
"path": "tvtk/pyface/ui/qt4/scene_editor.py",
"copies": "2",
"size": "8877",
"license": "bsd-3-clause",
"hash": -2363983492995635000,
"line_mean": 33.1423076923,
"line_max": 80,
"alpha_frac": 0.5615635913,
"autogenerated": false,
"ratio": 4.390207715133531,
"conf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.