text
stringlengths
0
1.05M
meta
dict
"""Assorted helper methods""" from collections import Iterable from .small_classes import Strings, Quantity def isequal(a, b): if (isinstance(a, Iterable) and not isinstance(a, Strings+(tuple, list, dict))): for i, a_i in enumerate(a): if not isequal(a_i, b[i]): ret...
{ "repo_name": "galbramc/gpkit", "path": "gpkit/small_scripts.py", "copies": "1", "size": "2512", "license": "mit", "hash": 6641886109513848000, "line_mean": 25.4421052632, "line_max": 79, "alpha_frac": 0.548566879, "autogenerated": false, "ratio": 3.8705701078582435, "config_test": false, "ha...
"""Assorted helper methods""" from collections import Iterable import numpy as np def appendsolwarning(msg, data, result, category="uncategorized", printwarning=False): "Append a particular category of warnings to a solution." if printwarning: print "Warning: %s\n" % msg if "w...
{ "repo_name": "convexopt/gpkit", "path": "gpkit/small_scripts.py", "copies": "1", "size": "3383", "license": "mit", "hash": 9010864775684146000, "line_mean": 28.4173913043, "line_max": 78, "alpha_frac": 0.6006503104, "autogenerated": false, "ratio": 3.420626895854398, "config_test": false, "h...
"""Assorted Tk-related subroutines used in Grail.""" from types import * from Tkinter import * def _clear_entry_widget(event): try: widget = event.widget widget.delete(0, INSERT) except: pass def install_keybindings(root): root.bind_class('Entry', '<Control-u>', _clear_entry_w...
{ "repo_name": "Jeff-Tian/mybnb", "path": "Python27/Tools/webchecker/tktools.py", "copies": "12", "size": "11552", "license": "apache-2.0", "hash": 4962211438567245000, "line_mean": 29.5628415301, "line_max": 77, "alpha_frac": 0.5901142659, "autogenerated": false, "ratio": 3.7324717285945073, "c...
"""Assorted tools for all aspects of funnelin' that don't fit elsewhere """ import logging import re import sys from datetime import date, datetime, timedelta from typing import Optional from dateutil.relativedelta import relativedelta from selenium import webdriver from webdriver_manager.chrome import ChromeDriverMan...
{ "repo_name": "PaulMcInnis/JobPy", "path": "jobfunnel/backend/tools/tools.py", "copies": "1", "size": "6263", "license": "mit", "hash": -9216326928547389000, "line_mean": 39.6688311688, "line_max": 79, "alpha_frac": 0.5824684656, "autogenerated": false, "ratio": 4.364459930313589, "config_test"...
"""Assorted utilities shared between parts of apitools.""" import collections import os import random from protorpc import messages import six from six.moves import http_client import six.moves.urllib.error as urllib_error import six.moves.urllib.parse as urllib_parse import six.moves.urllib.request as urllib_request...
{ "repo_name": "wemanuel/smry", "path": "smry/server-auth/ls/google-cloud-sdk/.install/.backup/lib/googlecloudapis/apitools/base/py/util.py", "copies": "4", "size": "7010", "license": "apache-2.0", "hash": 3095757246124527000, "line_mean": 32.8647342995, "line_max": 80, "alpha_frac": 0.6851640514, "...
"""Assorted utilities shared between parts of apitools.""" import random def calculate_wait_for_retry(retry_attempt, max_wait=60): """Calculate the amount of time to wait before a retry attempt. Wait time grows exponentially with the number of attempts. A random amount of jitter is added to spread out r...
{ "repo_name": "huangkuan/hack", "path": "lib/gcloud/streaming/util.py", "copies": "7", "size": "2112", "license": "apache-2.0", "hash": -3410826896478759400, "line_mean": 33.6229508197, "line_max": 73, "alpha_frac": 0.6581439394, "autogenerated": false, "ratio": 4.108949416342412, "config_test"...
""" Assorted utility functions and classes """ from os import path, listdir def is_type(typecheck, data): """ Generic type checker typically used to check that a string can be cast to int or float """ try: typecheck(data) except ValueError: return False else: return...
{ "repo_name": "ben-albrecht/qcl", "path": "qcl/utils.py", "copies": "1", "size": "1829", "license": "mit", "hash": 1111076110269307600, "line_mean": 28.9836065574, "line_max": 72, "alpha_frac": 0.6129032258, "autogenerated": false, "ratio": 4.185354691075515, "config_test": false, "has_no_key...
"""Assorted utility methods for use in creating posters.""" # Copyright 2016-2018 Florian Pigorsch & Contributors. All rights reserved. # # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import colour import math from typing import List, Optional, Tuple import s2sph...
{ "repo_name": "laufhannes/GpxTrackPoster", "path": "gpxtrackposter/utils.py", "copies": "1", "size": "3281", "license": "mit", "hash": 4575488768325399000, "line_mean": 32.4795918367, "line_max": 98, "alpha_frac": 0.5681194758, "autogenerated": false, "ratio": 3.1548076923076924, "config_test":...
"""Assorted utility methods for use in creating posters.""" # Copyright 2016-2021 Florian Pigorsch & Contributors. All rights reserved. # # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. import locale from itertools import takewhile, count as itercount import math i...
{ "repo_name": "flopp/GpxTrackPoster", "path": "gpxtrackposter/utils.py", "copies": "1", "size": "3880", "license": "mit", "hash": -3825925578117574000, "line_mean": 30.5447154472, "line_max": 107, "alpha_frac": 0.5889175258, "autogenerated": false, "ratio": 3.1493506493506493, "config_test": fa...
"""Assortment of helpers to print/manipulate data.""" import tempfile import os import csv import shutil from .config import get_config_section _html_options = get_config_section("HTMLOptions") _console_options = get_config_section("ConsoleOptions") def to_html(data): if not data: return fields = dat...
{ "repo_name": "sebasmonia/pyquebec", "path": "pyquebec/formatters.py", "copies": "1", "size": "3940", "license": "mit", "hash": 1774951417471794400, "line_mean": 33.8672566372, "line_max": 98, "alpha_frac": 0.6027918782, "autogenerated": false, "ratio": 3.3994823123382227, "config_test": false,...
"""Assortment of utilities for application.""" import itertools import operator import os import random from typing import List from flask_sqlalchemy import Model, SQLAlchemy from pma_api.app import PmaApiFlask B64_CHAR_SET = ''.join(('abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'...
{ "repo_name": "joeflack4/pma-api", "path": "pma_api/utils.py", "copies": "1", "size": "3999", "license": "mit", "hash": 172155126034156160, "line_mean": 23.0903614458, "line_max": 76, "alpha_frac": 0.6124031008, "autogenerated": false, "ratio": 4.015060240963855, "config_test": false, "has_no...
# Assume 1mb MaskROM import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) counter_clock = 19 counter_clear = 26 mask_oe = 6 mask_cs = 13 snes_d0 = 18 snes_d1 = 23 snes_d2 = 24 snes_d3 = 25 snes_d4 = 12 snes_d5 = 16 snes_d6 = 20 snes_d7 = 21 outputs = [counter_clock, counter_clear, mask_oe, mask_cs] datapins = ...
{ "repo_name": "breakin/breakin.github.io", "path": "journal/code/maskrom32extract-v1.py", "copies": "1", "size": "1465", "license": "mit", "hash": -5902981449660577000, "line_mean": 17.7948717949, "line_max": 70, "alpha_frac": 0.6744027304, "autogenerated": false, "ratio": 2.45393634840871, "co...
# assume admin login has already been handled import model import webapp2, jinja2, os, cgi from datetime import * from dateutil.parser import * from google.appengine.api import users jinja_environment = jinja2.Environment(autoescape=True, loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'vie...
{ "repo_name": "shickey/BearStatus", "path": "edit.py", "copies": "1", "size": "4615", "license": "mit", "hash": -262316631831691680, "line_mean": 29.3684210526, "line_max": 95, "alpha_frac": 0.5677139762, "autogenerated": false, "ratio": 4.484936831875608, "config_test": false, "has_no_keywor...
"""Assume atmospheric profile which comes from Sarazin and Tokovinin (2002): - 0.86" seeing - tau_0=3.9ms, which is 9.4m/s wind. But lets double this to cover more actual seeing conditions. We will just move through the wavefront with nd.interpolation.shift, with a wrap. """ import astropy.constants as const import ...
{ "repo_name": "mikeireland/opticstools", "path": "playground/piston_offsets.py", "copies": "1", "size": "6667", "license": "mit", "hash": -4567744046596762600, "line_mean": 36.2458100559, "line_max": 148, "alpha_frac": 0.6356682166, "autogenerated": false, "ratio": 2.6861402095084608, "config_t...
#assume price and category are given: from PIL import Image import sys import math import numpy import json import sys import os import web import sqlite3 as sqlite # set boundaries in query_padmapper # from query_padmapper import MAX_LAT, MAX_LON, MIN_LAT, MIN_LON APP_PATH = os.getcwd() MIN_LAT = 37.3 MAX_LAT = 37...
{ "repo_name": "selinerguncu/Yelp-Spatial-Analysis", "path": "maps/pilMap.py", "copies": "1", "size": "8141", "license": "mit", "hash": 5808759682872090000, "line_mean": 27.6654929577, "line_max": 155, "alpha_frac": 0.5912050117, "autogenerated": false, "ratio": 3.1900470219435735, "config_test"...
# Assume python 2.7 # Path to the interpreter is deliberately not mentioned. import os import errno import sys import optparse import shlex import subprocess import threading import getpass from datetime import datetime import json def print_and_exit(rc, message): if len(message): print message sys.ex...
{ "repo_name": "alexeypolo/wimp", "path": "wimp.py", "copies": "1", "size": "7996", "license": "mit", "hash": 9082865074527243000, "line_mean": 33.0255319149, "line_max": 121, "alpha_frac": 0.6585792896, "autogenerated": false, "ratio": 3.524019391802556, "config_test": false, "has_no_keywords...
# assumes all letters are lowercase alphabetical (all uppercase should work too, but not mixed or any other characters or non-characters) from bisect import bisect # binary search ''' ALPHABET_LEN = ord('z') - ord('a') + 1 def dist_to_letter(target, letter): if target == letter: return ALPHABET_LEN # bec...
{ "repo_name": "SelvorWhim/competitive", "path": "LeetCode/FindSmallestLetterGreaterThanTarget.py", "copies": "1", "size": "1758", "license": "unlicense", "hash": 3601526609144449500, "line_mean": 46.5405405405, "line_max": 250, "alpha_frac": 0.6587030717, "autogenerated": false, "ratio": 3.796976...
# assumes credential file in .aws folder in user directory import json import os import boto3 import metadata s3 = boto3.resource('s3') def main(): bucket_name = 'canal-photos-chester' bucket_region = 'us-west-1' bucket = s3.Bucket(bucket_name) photo_directory = r'C:\_webdev\maps\canal-map-photos\can...
{ "repo_name": "gdmf/canal-map", "path": "utils/boto_ops.py", "copies": "1", "size": "3046", "license": "unlicense", "hash": -4041823105450446300, "line_mean": 27.2037037037, "line_max": 85, "alpha_frac": 0.5778069599, "autogenerated": false, "ratio": 3.798004987531172, "config_test": false, "...
# Assumes DB Drivers are installed correctly import json import requests import pyodbc from bs4 import BeautifulSoup from random import shuffle # SQL Server Example # db007 = { # "Driver": "{SQL Server}", # "Server": "server.domain.site.com", # "Database": "DatabaseName", # "Trusted_Connection": "yes...
{ "repo_name": "jebstone/examples", "path": "very_basic_scraper_with_results_to_db.py", "copies": "1", "size": "2149", "license": "unlicense", "hash": -3143858695658119700, "line_mean": 23.988372093, "line_max": 135, "alpha_frac": 0.6863657515, "autogenerated": false, "ratio": 3.285932721712538, ...
# Assumes dict d of information about found citations is given # Need to marry these functions with whichever keys are options # This really just gives some of the basic logic for how to display the pulled data # Sample inputs # d = {'citations': [{'citation_date': '2015-03-09', 'citation_number': 789674515, 'last_nam...
{ "repo_name": "xHeliotrope/injustice_dropper", "path": "parseDict.py", "copies": "1", "size": "3890", "license": "mit", "hash": 5980209397053860000, "line_mean": 49.5324675325, "line_max": 708, "alpha_frac": 0.6827763496, "autogenerated": false, "ratio": 2.958174904942966, "config_test": false,...
# Assume `s` is a string of lower case characters. # Write a program that prints the longest substring of `s` in which the letters occur in alphabetical order. # For example, if `s` = 'azcbobobegghakl', then your program should print: # "Longest substring in alphabetical order is: beggh" # In the case of ties, print th...
{ "repo_name": "FylmTM/edX-code", "path": "MITx_6.00.1x/problem_set_1/3_alphabeticals_substrings.py", "copies": "1", "size": "1218", "license": "mit", "hash": 5101748456004198000, "line_mean": 39.6333333333, "line_max": 111, "alpha_frac": 0.6863711002, "autogenerated": false, "ratio": 3.3188010899...
# Assumes null_sym_source/target = 0 # unk_sym_source/target = 1 # Verify what is missing from each dict # How was it saved (0,-1) ##For full vocab # iv : iv[0] = '<\s>' # iv : iv[1] : KeyError ## v : v['<\s>'] = 0 ## v : v['<s>'] = 0 ### len(v) = len(iv) + 1 ### Use *_sym_* in state to specify <UNK> and <EOS> impo...
{ "repo_name": "vseledkin/LV_groundhog", "path": "experiments/nmt/utils/filter_vocab.py", "copies": "3", "size": "4386", "license": "bsd-3-clause", "hash": -1012615645398388600, "line_mean": 35.2561983471, "line_max": 122, "alpha_frac": 0.5820793434, "autogenerated": false, "ratio": 2.615384615384...
""" Assumes softplus activations for gaussian """ import tensorflow as tf import numpy as np def log_bernoulli(x, logits, eps=0.0, axis=-1): return log_bernoulli_with_logits(x, logits, eps, axis) def log_bernoulli_with_logits(x, logits, eps=0.0, axis=-1): if eps > 0.0: max_val = np.log(1.0 - eps) - np...
{ "repo_name": "RuiShu/tensorbayes", "path": "tensorbayes/distributions.py", "copies": "1", "size": "1081", "license": "mit", "hash": -2308511000460664300, "line_mean": 36.275862069, "line_max": 79, "alpha_frac": 0.5642923219, "autogenerated": false, "ratio": 2.689054726368159, "config_test": fa...
# Assumes use of the SyncServer_SharedImages database. from locust import HttpLocust, Locust, TaskSet, task import json import uuid import random with open('accessTokens.json') as json_file: tokens = json.load(json_file) user1AccessToken = tokens["user1AccessToken"] user2AccessToken = tokens["user2AccessT...
{ "repo_name": "crspybits/SyncServerII", "path": "LoadTesting/locustfile.py", "copies": "1", "size": "17636", "license": "mit", "hash": -3190030205481814500, "line_mean": 38.5426008969, "line_max": 136, "alpha_frac": 0.6421524155, "autogenerated": false, "ratio": 4.250662810315739, "config_test"...
#assumes you have gnu sed, osx sed might need slight syntax changeo #c.f. http://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files #written by shen-noether monero research labs import os #for copying and sed etc. import glob #for copy files import textwrap #for comments etc print("make su...
{ "repo_name": "ranok/bitmonero", "path": "src/crypto/crypto_ops_builder/ref10CommentedCombined/MakeCryptoOps.py", "copies": "2", "size": "9681", "license": "bsd-3-clause", "hash": 1343448710920573400, "line_mean": 36.091954023, "line_max": 234, "alpha_frac": 0.64249561, "autogenerated": false, "r...
# Assume you are given two dictionaries d1 and d2, each with integer keys and # integer values. You are also given a function f, that takes in two integers, # performs an unknown operation on them, and returns a value. # Write a function called dict_interdiff that takes in two dictionaries (d1 and # d2). The functi...
{ "repo_name": "emyarod/OSS", "path": "1_intro/6.00.1x/Quiz/Problem 7.py", "copies": "1", "size": "2101", "license": "mit", "hash": -2661961493018195000, "line_mean": 41.04, "line_max": 88, "alpha_frac": 0.6554021894, "autogenerated": false, "ratio": 3.2523219814241484, "config_test": false, "...
## Assume you have run vr_kuka_setup and have default scene set up # Require p.setInternalSimFlags(0) in kuka_setup import pybullet as p import math # import numpy as np p.connect(p.SHARED_MEMORY) kuka = 3 kuka_gripper = 7 POSITION = 1 ORIENTATION = 2 ANALOG = 3 BUTTONS = 6 THRESHOLD = .5 LOWER_LIMITS = [-.967, -2.0...
{ "repo_name": "MadManRises/Madgine", "path": "shared/bullet3-2.89/examples/pybullet/examples/vr_kuka_control.py", "copies": "2", "size": "3423", "license": "mit", "hash": 8916091336469085000, "line_mean": 32.8910891089, "line_max": 98, "alpha_frac": 0.4934268186, "autogenerated": false, "ratio": ...
# assuming non-overlapping and initially sorted class Solution: def insert(self, intervals: List[List[int]], newInterval: List[int]) -> List[List[int]]: found = False # todo: optimize with binary search, since they're sorted for i in range(len(intervals)): # insert case...
{ "repo_name": "SelvorWhim/competitive", "path": "LeetCode/InsertInterval.py", "copies": "1", "size": "1145", "license": "unlicense", "hash": 878556082735027300, "line_mean": 37.1666666667, "line_max": 92, "alpha_frac": 0.5065502183, "autogenerated": false, "ratio": 4.35361216730038, "config_tes...
# Assuming that we are given # rho rho_t rho_x rho_xx rho_xy rho_xz rho_y rho_yy rho_yz rho_z rho_zz # u u_t u_x u_xx u_xy u_xz u_y u_yy u_yz u_z u_zz # v v_t v_x v_xx v_xy v_xz v_y v_yy v_yz v_z v_zz # w w_t w_x w_xx w_xy w_xz w_y w_yy w_yz w_z w_zz #...
{ "repo_name": "nicholasmalaya/arcanus", "path": "disputatio/dissertation/mms/forcing.py", "copies": "2", "size": "5268", "license": "mit", "hash": -912041578386577200, "line_mean": 46.0357142857, "line_max": 79, "alpha_frac": 0.4345102506, "autogenerated": false, "ratio": 1.9826872412495296, "c...
# assuming this is run by pytest: http://doc.pytest.org/en/latest/ # e.g. # py.test tests/unittests.py # or # py.test -s tests/unittests.py from __future__ import print_function import sys,os sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) import phrasemachine as pm import pytest def test_custom_...
{ "repo_name": "slanglab/phrasemachine", "path": "py/tests/test_all.py", "copies": "1", "size": "3370", "license": "mit", "hash": -8456857334137674000, "line_mean": 39.119047619, "line_max": 135, "alpha_frac": 0.6430267062, "autogenerated": false, "ratio": 3.052536231884058, "config_test": true,...
# assuming words contain alphabetical only from collections import Counter ORD_A = ord('a') ORD_Z = ord('z') ALPHABET_LEN = ORD_Z - ORD_A + 1 # alphabetic, lowercase def letter_counter(word): c = [0]*ALPHABET_LEN for l in word.lower(): i = ord(l) if i >= ORD_A and i <= ORD_Z: c[i -...
{ "repo_name": "SelvorWhim/competitive", "path": "LeetCode/ShortestCompletingWord.py", "copies": "1", "size": "1087", "license": "unlicense", "hash": 884044485348578800, "line_mean": 26.8717948718, "line_max": 67, "alpha_frac": 0.5124195032, "autogenerated": false, "ratio": 3.7874564459930316, "...
### Assumption: All kids should be prepared to work together and have something to learn from each other # Assign students partners # -each kid # *skill: math, reading, science, social studies, other # *skill level: high, medium, low # *social: leader # ...
{ "repo_name": "DanaMercury/Buddies", "path": "buddies.py", "copies": "1", "size": "5574", "license": "cc0-1.0", "hash": -6255100610587421000, "line_mean": 37.4482758621, "line_max": 142, "alpha_frac": 0.6157158235, "autogenerated": false, "ratio": 3.7409395973154362, "config_test": false, "ha...
# a stacked bar plot with errorbars import numpy as np import matplotlib.pyplot as plt N = 5 menMeans = (20, 35, 30, 35, 27) womenMeans = (25, 32, 34, 20, 25) menStd = (2, 3, 4, 1, 2) womenStd = (3, 5, 2, 3, 3) ind = np.arange(N) # the x locations for the groups width = 0.35 # the width of the bars: can also b...
{ "repo_name": "kcrandall/Kaggle_Mercedes_Manufacturing", "path": "spark/experiements/reza/logging_lib/example.py", "copies": "6", "size": "1160", "license": "mit", "hash": -3427162537374826500, "line_mean": 32.1428571429, "line_max": 71, "alpha_frac": 0.6931034483, "autogenerated": false, "ratio"...
# a stacked bar plot with errorbars import sys import os.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, "Classification"))) import numpy as np import matplotlib.pyplot as plt plt.switch_backend('agg') import util cmb_model = util.load_model("../Data/cmb.pkl"...
{ "repo_name": "dabrze/CheckMyBlob", "path": "Figures/SFig3_labels.py", "copies": "1", "size": "2364", "license": "mit", "hash": 3654946939095758300, "line_mean": 32.7647058824, "line_max": 132, "alpha_frac": 0.6497461929, "autogenerated": false, "ratio": 2.7203682393555813, "config_test": false...
""" A Stack using a linked list like structure """ from typing import Any, Optional class Node: def __init__(self, data): self.data = data self.next = None def __str__(self): return f"{self.data}" class LinkedStack: """ Linked List Stack implementing push (to ...
{ "repo_name": "TheAlgorithms/Python", "path": "data_structures/stacks/linked_stack.py", "copies": "1", "size": "3713", "license": "mit", "hash": -3849588068950014500, "line_mean": 21.3522012579, "line_max": 54, "alpha_frac": 0.4284944789, "autogenerated": false, "ratio": 4.08021978021978, "conf...
# AST analysis import os import coda.compiler from coda import descriptors from coda import types from coda.runtime.object import Object from coda.runtime.typeregistry import TypeRegistry from collections import defaultdict from coda.runtime import typemixins class GenericType(coda.types.Type): def __init__(self, t...
{ "repo_name": "viridia/coda", "path": "libs/coda/compiler/analyzer.py", "copies": "1", "size": "28667", "license": "apache-2.0", "hash": 7963442063808145000, "line_mean": 35.1957070707, "line_max": 101, "alpha_frac": 0.6524226462, "autogenerated": false, "ratio": 3.7268590743629746, "config_tes...
"""A standardized logger. The log level can be configured using the environment variable CLOUDLY_LOG_LEVEL. Otherwise, defaults to 'info'. """ import os import logging from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL # noqa FORMAT = "%(asctime)s] %(levelname)s %(module)s %(funcName)s: %(message)s" DEFAULT_...
{ "repo_name": "ooda/cloudly", "path": "cloudly/logger.py", "copies": "1", "size": "1813", "license": "mit", "hash": -27608756042359720, "line_mean": 26.8923076923, "line_max": 74, "alpha_frac": 0.6613348042, "autogenerated": false, "ratio": 3.7458677685950414, "config_test": false, "has_no_ke...
## AST and Parser # Local Imports import Token from Lexer import * ## AST # # Abstract Syntax Tree that represents the parse tree of the # parsed Tokens class AST(object): pass ## All # # Special ALL keyword. Means all objects in current state with # type arg class All(AST): ## Constructor def __init__(self,...
{ "repo_name": "jhomble/electron435", "path": "python_causal_compiler/compiler/Parser.py", "copies": "1", "size": "12555", "license": "mit", "hash": 7876241018276855000, "line_mean": 19.9266666667, "line_max": 80, "alpha_frac": 0.6434090004, "autogenerated": false, "ratio": 2.841140529531568, "c...
"""A stanza queue to prevent race conditions and other things. """ from twisted.internet import task class StanzaQueue(object): """ """ def __init__(self, cb_presence = None, cb_groupchat = None): self.started = False self.stz_pending = {} self.delayed_queue = [] ...
{ "repo_name": "twonds/palaver", "path": "palaver/stanzaqueue.py", "copies": "1", "size": "1854", "license": "mit", "hash": -7149211584615793000, "line_mean": 31.5263157895, "line_max": 84, "alpha_frac": 0.5453074434, "autogenerated": false, "ratio": 3.715430861723447, "config_test": false, "h...
"""A-Star (A*) Search is a search strategy where, starting at the root of a tree of nodes to explore, each node's children are explored in order of a combination of lowest movement cost, with cost accumulating per move and a heuristic cost. Priority of exploration is given to those remaining with lowest combined cost....
{ "repo_name": "PhilipCastiglione/learning-machines", "path": "uninformed_search/algorithms/astar.py", "copies": "1", "size": "6146", "license": "mit", "hash": 7661744018113273000, "line_mean": 41.6805555556, "line_max": 92, "alpha_frac": 0.6332574032, "autogenerated": false, "ratio": 4.2009569377...
"astar.py - A* pathfinding module for Pyro" # This module assumes movement on a grid, rather than an arbitrary graph. from util import * from heapq import heappush, heappop from math import sqrt class NodeList(BASEOBJ): def __init__(self, name="nodelist"): self.nodes, self.idx = [], {} ...
{ "repo_name": "amirjabri/pyro", "path": "astar.py", "copies": "1", "size": "4017", "license": "mit", "hash": 8904570144837521000, "line_mean": 37.7920792079, "line_max": 95, "alpha_frac": 0.4934030371, "autogenerated": false, "ratio": 3.5205959684487294, "config_test": false, "has_no_keywords...
# AStar.py # A* Search of a problem space. # Ver 0.1, October 19, 2017. # Usage: # python3 AStar.py EightPuzzleWithHeuristics h_euclidean puzzle2a import sys from priorityq import PriorityQ if sys.argv == [''] or len(sys.argv) < 3: import EightPuzzleWithHeuristics as Problem CHOSEN_HEURISTIC = 'h_manhattan'...
{ "repo_name": "vaibhavi-r/CSE-415", "path": "Assignment3/AStarOld.py", "copies": "1", "size": "4298", "license": "mit", "hash": -3426961651673970000, "line_mean": 27.2828947368, "line_max": 88, "alpha_frac": 0.5805025593, "autogenerated": false, "ratio": 3.4247011952191233, "config_test": false...
# astar.py # trying draft version import time, sys, heapq import numpy as np import pygame as pg from pg_part import * #import cv2 from operator import attrgetter from pygame.locals import * ''' source - red wall - black target - blue path - green ''' # -----------------------------------------------...
{ "repo_name": "abidrahmank/MyRoughWork", "path": "maze_solver/rough/astar.py", "copies": "1", "size": "10016", "license": "mit", "hash": -6322901798522394000, "line_mean": 33.4192439863, "line_max": 148, "alpha_frac": 0.455471246, "autogenerated": false, "ratio": 3.7654135338345864, "config_tes...
import time import threading import smbus import struct import sys class AStar: def __init__(self): self._bus = smbus.SMBus(1) self._version = sys.version_info.major self.ledYellow = 0 self.ledGreen = 0 self.ledRed = 0 self._buttonA = 0 self._buttonB = 0 ...
{ "repo_name": "DrGFreeman/RasPiBot202V2", "path": "pi/astar.py", "copies": "1", "size": "9666", "license": "mit", "hash": 7609489151109617000, "line_mean": 35.1985018727, "line_max": 80, "alpha_frac": 0.5750051728, "autogenerated": false, "ratio": 4.0107883817427386, "config_test": false, "ha...
# A starter kit for the graph/matrix exercise import collections def adjlist(adj_list): """ Read in adj list and store in form of dict mapping node name to list of outgoing edges. Preserve the order you find for the nodes. """ adj = collections.OrderedDict() # keep stuff in order read from string # fill in r...
{ "repo_name": "chhavi21/msan501", "path": "labs/code/graphs/graph.py", "copies": "3", "size": "1101", "license": "bsd-3-clause", "hash": -5451312958057006000, "line_mean": 19.7735849057, "line_max": 75, "alpha_frac": 0.6811989101, "autogenerated": false, "ratio": 3.101408450704225, "config_test...
#a star with color import time import pygame from pygame.locals import * from operator import itemgetter class node(object): #a very simple class simply used to store information def __init__(self, x, y, parent, gscore): self.x, self.y = x,y # position on the grid self.parent = parent # pointer ...
{ "repo_name": "abidrahmank/MyRoughWork", "path": "maze_solver/final_maze_ 1.0.2.10_demo/Leetest_1.0.2.10/LeeColor.py", "copies": "1", "size": "12063", "license": "mit", "hash": -6280024352339706000, "line_mean": 45.0419847328, "line_max": 128, "alpha_frac": 0.4202105612, "autogenerated": false, "...
# as task I most to implement the other sort algorithms class QuickSort: def __init__(self, arr, is_decrease=True): self.arr = arr self.is_decrease = is_decrease def get_arr(self): if len(self.arr) == 1: return self.arr if self.is_decrease: self.quick_s...
{ "repo_name": "ragnarok22/encriptednetwork", "path": "algorithm/sort.py", "copies": "1", "size": "1606", "license": "mit", "hash": -4998332663863325000, "line_mean": 27.6785714286, "line_max": 68, "alpha_frac": 0.4196762142, "autogenerated": false, "ratio": 3.3250517598343685, "config_test": fa...
"""a state engine. """ import pygame from pygame.locals import * class State: """Template Class -- for a state. Arguments: game -- The state engine. value -- I usually pass in a custom value to a state For all of the template methods, they should return None unless they return a...
{ "repo_name": "Southpaw-TACTIC/Team", "path": "src/python/Lib/site-packages/pgu/engine.py", "copies": "1", "size": "3499", "license": "epl-1.0", "hash": -1622266453571967000, "line_mean": 25.3082706767, "line_max": 101, "alpha_frac": 0.5364389826, "autogenerated": false, "ratio": 4.37922403003754...
""" A static class that allows the type of a file to be checked. """ import os from subprocess import PIPE from .popenwrapper import Popen class FileType: """ A hack to grok the type of input files. """ # These are just here to keep pylint happy. UNKNOWN = None ELF_EXECUTABLE = None ELF_OBJE...
{ "repo_name": "travitch/whole-program-llvm", "path": "wllvm/filetype.py", "copies": "2", "size": "2741", "license": "mit", "hash": -2678989733032616400, "line_mean": 29.4555555556, "line_max": 76, "alpha_frac": 0.5260853703, "autogenerated": false, "ratio": 4.364649681528663, "config_test": fal...
''' AST BaseNode Abstract Class ''' from helper import * '''utils functions''' indentLevel = 0 outputString = [] def indent(): global indentLevel indentLevel += 1 def outdent(): global indentLevel indentLevel -= 1 def append(val): global outputString if isinstance(val, list): outp...
{ "repo_name": "zhengkaifu/PingPHP", "path": "src/nodes.py", "copies": "1", "size": "21197", "license": "mit", "hash": -5506492932397695000, "line_mean": 21.6463675214, "line_max": 73, "alpha_frac": 0.5554559607, "autogenerated": false, "ratio": 3.849800217944061, "config_test": false, "has_no...
"""AST classes pending implementation.""" from scoff.ast import ScoffASTObject class AXIDescription(ScoffASTObject): """AXIDescription AST.""" __slots__ = ("static_declarations", "params", "statements") def __init__( self, parent=None, static_declarations=None, params=No...
{ "repo_name": "brunosmmm/hdltools", "path": "hdltools/mmap/ast.py", "copies": "1", "size": "7133", "license": "mit", "hash": 6593967054202045000, "line_mean": 22.9362416107, "line_max": 78, "alpha_frac": 0.5666619936, "autogenerated": false, "ratio": 3.9561841375485303, "config_test": false, ...
# A stereo "White Noise" generator using STANDARD Python 2.5.2 or higher. # This is for (PC)Linux(OS), (ONLY?), and was done purely for fun. # # It is another simple piece of testgear for the amateur electronics # enthusiast and uses /dev/dsp instead of /dev/audio. Enjoy... ;o) # # (Original copyright, (C)2010, B.Walke...
{ "repo_name": "ActiveState/code", "path": "recipes/Python/577604_Simple_White_Noise_Generator_Using_Standard/recipe-577604.py", "copies": "1", "size": "3510", "license": "mit", "hash": 7276491850625021000, "line_mean": 31.5, "line_max": 96, "alpha_frac": 0.7065527066, "autogenerated": false, "rat...
"""asteria URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/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-bas...
{ "repo_name": "elespike/Asteria", "path": "asteria/urls.py", "copies": "1", "size": "2896", "license": "mit", "hash": 1198885713320745200, "line_mean": 47.2666666667, "line_max": 109, "alpha_frac": 0.5856353591, "autogenerated": false, "ratio": 3.4517282479141835, "config_test": false, "has_n...
"""Asterisk FastAGI server for use from the dialplan You use an asterisk FastAGI like this from extensions.conf: exten => 1000,3,AGI(agi://127.0.0.1:4573,arg1,arg2) Where 127.0.0.1 is the server and 4573 is the port on which the server is listening. Module defines a standard Python logging module log 'FastAGI' ...
{ "repo_name": "arjan/starpy", "path": "starpy/fastagi.py", "copies": "1", "size": "36232", "license": "bsd-3-clause", "hash": 6110702939346550000, "line_mean": 40.5504587156, "line_max": 125, "alpha_frac": 0.5924597041, "autogenerated": false, "ratio": 4.522216674987519, "config_test": false, ...
"""Asterisk Manager Interface for the Twisted networking framework The Asterisk Manager Interface is a simple line-oriented protocol that allows for basic control of the channels active on a given Asterisk server. Module defines a standard Python logging module log 'AMI' """ from twisted.internet import protocol, rea...
{ "repo_name": "arjan/starpy", "path": "starpy/manager.py", "copies": "1", "size": "30059", "license": "bsd-3-clause", "hash": -1177239257429791700, "line_mean": 42.5637681159, "line_max": 174, "alpha_frac": 0.6092351708, "autogenerated": false, "ratio": 4.657421753951038, "config_test": false, ...
# Asteroids example game, demonstrating several entity/component design choices. # Requires Python 3.8+ and the pygame library. Arrow keys and space to control. Esc to quit. # I suggest playing the game for a minute before looking at the code. import pygame, math, random, enco from pygame.locals import * screensize =...
{ "repo_name": "cosmologicon/enco", "path": "example-asteroids.py", "copies": "1", "size": "11967", "license": "unlicense", "hash": -210189664801027260, "line_mean": 30.0831168831, "line_max": 95, "alpha_frac": 0.6984206568, "autogenerated": false, "ratio": 2.8753003363767418, "config_test": fal...
# "ASTEROIDS" # Nikolay Grishchenko, 2014 # web@grischenko.ru # # PLEASE BE AWARE THAT THIS CODE IS ADOPTED ONLY # FOR CODESKULPTOR IN COURSERA CLASS. # IT DOES NOT COMPILE AS IS! # import simplegui import math from random import random, randrange, choice # Game settings. Constants. LIVES = 3 # Default lives WIDTH =...
{ "repo_name": "ngr/sandbox", "path": "python/asteroids.py", "copies": "1", "size": "15978", "license": "mit", "hash": 9059257902395820000, "line_mean": 37.6876513317, "line_max": 129, "alpha_frac": 0.6085242208, "autogenerated": false, "ratio": 3.239002635313197, "config_test": false, "has_no...
# astests_pyb.py # Tests for AS_GPS module. Emulates a GPS unit using a UART loopback. # Run on a Pyboard with X1 and X2 linked # Tests for AS_GPS module (asynchronous GPS device driver) # Based on tests for MicropyGPS by Michael Calvin McCoy # https://github.com/inmcm/micropyGPS # Copyright (c) 2018-2020 Peter Hinch...
{ "repo_name": "peterhinch/micropython-async", "path": "v3/as_drivers/as_GPS/astests_pyb.py", "copies": "1", "size": "6747", "license": "mit", "hash": -2437674435312698000, "line_mean": 43.6821192053, "line_max": 110, "alpha_frac": 0.60560249, "autogenerated": false, "ratio": 2.759509202453988, ...
import ast, copy from ast_utils import * class Inliner: def setup_inliner(self, writer): self.writer = writer self._with_inline = False self._inline = [] self._inline_ids = 0 self._inline_breakout = False def inline_helper_remap_names(self, remap): return "JS('var %s')" %','.join(remap.values()) def i...
{ "repo_name": "chiyama/PythonJS", "path": "pythonjs/inline_function.py", "copies": "6", "size": "2238", "license": "bsd-3-clause", "hash": -6951807192025397000, "line_mean": 24.4318181818, "line_max": 63, "alpha_frac": 0.6327077748, "autogenerated": false, "ratio": 2.7392900856793148, "config_t...
# Copyright (c) 2018-2020 Peter Hinch # Released under the MIT License (MIT) - see LICENSE file # TODO Test machine version. Replace LED with callback. Update tests and doc. import uasyncio as asyncio import machine try: import pyb on_pyboard = True rtc = pyb.RTC() except ImportError: on_pyboard = Fal...
{ "repo_name": "peterhinch/micropython-async", "path": "v3/as_drivers/as_GPS/as_tGPS.py", "copies": "1", "size": "10508", "license": "mit", "hash": -3436935152533579000, "line_mean": 42.7416666667, "line_max": 90, "alpha_frac": 0.6064964755, "autogenerated": false, "ratio": 3.377734877734878, "c...
# Copyright (c) 2018 Peter Hinch # Released under the MIT License (MIT) - see LICENSE file # TODO Test machine version. Replace LED with callback. Update tests and doc. import uasyncio as asyncio import machine try: import pyb on_pyboard = True rtc = pyb.RTC() except ImportError: on_pyboard = False im...
{ "repo_name": "peterhinch/micropython-async", "path": "v2/gps/as_tGPS.py", "copies": "1", "size": "10558", "license": "mit", "hash": 9020208297725953000, "line_mean": 42.7676348548, "line_max": 93, "alpha_frac": 0.6065604854, "autogenerated": false, "ratio": 3.37104506232023, "config_test": fal...
"""ASTNG hooks for the Python 2 standard library. Currently help understanding of : * hashlib.md5 and hashlib.sha1 """ from logilab.astng import MANAGER from logilab.astng.builder import ASTNGBuilder MODULE_TRANSFORMS = {} def hashlib_transform(module): fake = ASTNGBuilder(MANAGER).string_build(''' class md5(...
{ "repo_name": "tlksio/tlksio", "path": "env/lib/python3.4/site-packages/logilab/astng/brain/py2stdlib.py", "copies": "1", "size": "4246", "license": "mit", "hash": -6912772612641845000, "line_mean": 22.3296703297, "line_max": 63, "alpha_frac": 0.6497880358, "autogenerated": false, "ratio": 3.7442...
# AST nodes for micro-ML. # # Eli Bendersky [http://eli.thegreenplace.net] # This code is in the public domain. class ASTNode: def visit_children(self, func): """Visit all children with a function that takes a child node.""" for child in self._children: func(child) # Used by the ty...
{ "repo_name": "eliben/code-for-blog", "path": "2018/type-inference/ast.py", "copies": "1", "size": "2937", "license": "unlicense", "hash": 4551662777410067500, "line_mean": 25.2232142857, "line_max": 78, "alpha_frac": 0.5767790262, "autogenerated": false, "ratio": 3.7847938144329896, "config_te...
"""AST nodes generated by the parser for the compiler. Also provides some node tree helper functions used by the parser and compiler in order to normalize nodes. """ import inspect import operator from collections import deque from typing import Any from typing import Tuple as TupleType from markupsafe import Markup ...
{ "repo_name": "mitsuhiko/jinja2", "path": "src/jinja2/nodes.py", "copies": "2", "size": "30186", "license": "bsd-3-clause", "hash": -634074959863519200, "line_mean": 27.4505183789, "line_max": 85, "alpha_frac": 0.6035248128, "autogenerated": false, "ratio": 4.035022055874883, "config_test": fal...
"""AST nodes generated by the parser for the compiler. Also provides some node tree helper functions used by the parser and compiler in order to normalize nodes. """ import inspect import operator import typing as t from collections import deque from markupsafe import Markup from .utils import _PassArg if t.TYPE_CHE...
{ "repo_name": "pallets/jinja", "path": "src/jinja2/nodes.py", "copies": "1", "size": "34509", "license": "bsd-3-clause", "hash": 7240030929555247000, "line_mean": 27.6381742739, "line_max": 88, "alpha_frac": 0.6006549016, "autogenerated": false, "ratio": 3.8467283468955524, "config_test": false...
"""utilities for analyzing expressions and blocks of Python code, as well as generating Python from AST nodes""" from mako import exceptions, pyparser, util import re class PythonCode(object): """represents information about a string containing Python code""" def __init__(self, code, **exception_kwargs): ...
{ "repo_name": "bdoms/mako", "path": "ast.py", "copies": "2", "size": "5251", "license": "mit", "hash": -8948120892019975000, "line_mean": 41.008, "line_max": 129, "alpha_frac": 0.5945534184, "autogenerated": false, "ratio": 4.217670682730923, "config_test": false, "has_no_keywords": false, ...
"""utilities for analyzing expressions and blocks of Python code, as well as generating Python from AST nodes""" from mako import exceptions, pyparser, util import re class PythonCode(object): """represents information about a string containing Python code""" def __init__(self, code, **exception_kwargs): ...
{ "repo_name": "farseerfc/jgments", "path": "lib/Mako-0.3.4/mako/ast.py", "copies": "21", "size": "5646", "license": "bsd-2-clause", "hash": -7867280888822451000, "line_mean": 38.4825174825, "line_max": 89, "alpha_frac": 0.5501239816, "autogenerated": false, "ratio": 4.463241106719368, "config_t...
"""utilities for analyzing expressions and blocks of Python code, as well as generating Python from AST nodes""" from mako import exceptions, pyparser, util import re class PythonCode(object): """represents information about a string containing Python code""" def __init__(self, code, **exception_kwargs): ...
{ "repo_name": "bhatfield/titanium_mobile", "path": "support/common/mako/ast.py", "copies": "46", "size": "5239", "license": "apache-2.0", "hash": -3650610462567076400, "line_mean": 40.912, "line_max": 129, "alpha_frac": 0.594388242, "autogenerated": false, "ratio": 4.221595487510073, "config_te...
"""utilities for analyzing expressions and blocks of Python code, as well as generating Python from AST nodes""" from compiler import ast, visitor from compiler import parse as compiler_parse from mako import util, exceptions from StringIO import StringIO import re def parse(code, mode, **exception_kwargs): try:...
{ "repo_name": "gdubost1/shaderman", "path": "mako/ast.py", "copies": "5", "size": "13990", "license": "bsd-3-clause", "hash": 2980278161335682600, "line_mean": 39.7900874636, "line_max": 248, "alpha_frac": 0.5486061472, "autogenerated": false, "ratio": 4.02821767923985, "config_test": false, ...
"""Handles parsing of Python code. Parsing to AST is done via _ast on Python > 2.5, otherwise the compiler module is used. """ from StringIO import StringIO from mako import exceptions, util # words that cannot be assigned to (notably smaller than the total keys in __builtins__) reserved = util.Set(['True', 'False'...
{ "repo_name": "collinprice/titanium_mobile", "path": "support/common/mako/pyparser.py", "copies": "42", "size": "15757", "license": "apache-2.0", "hash": 3209651881480400000, "line_mean": 41.4716981132, "line_max": 249, "alpha_frac": 0.5453449261, "autogenerated": false, "ratio": 4.09379059495973...
"""Handles parsing of Python code. Parsing to AST is done via _ast on Python > 2.5, otherwise the compiler module is used. """ import sys from StringIO import StringIO from mako import exceptions, util # words that cannot be assigned to (notably smaller than the total keys in __builtins__) reserved = set(['True', '...
{ "repo_name": "gabriel/shrub", "path": "lib/mako/pyparser.py", "copies": "6", "size": "15783", "license": "mit", "hash": -5380666832497631000, "line_mean": 41.3136729223, "line_max": 249, "alpha_frac": 0.545587024, "autogenerated": false, "ratio": 4.082514226590791, "config_test": false, "has...
# ---------------- AStrading - Update -------------- # --------------- Created by Aron Svedin ----------- # -------------------- 2016-01-25 ------------------ ''' Update functions for Classes in Models - Update SCTR - updatingSCTR() in: array (Adj Close) out: float (Average SCTR over SCTR_AVERAGE days, EMA50) ...
{ "repo_name": "ASpelling/mw-trading", "path": "app/update.py", "copies": "1", "size": "3665", "license": "apache-2.0", "hash": -5847947047986967000, "line_mean": 26.6328125, "line_max": 127, "alpha_frac": 0.6163710778, "autogenerated": false, "ratio": 2.6557971014492754, "config_test": false, ...
"""Astral geocoder is a database of locations stored within the package. To get the :class:`~astral.LocationInfo` for a location use the :func:`~astral.geocoder.lookup` function e.g. :: from astral.geocoder import lookup, database l = lookup("London", database()) All locations stored in the database can be a...
{ "repo_name": "sffjunkie/astral", "path": "src/astral/geocoder.py", "copies": "2", "size": "25932", "license": "apache-2.0", "hash": 805844747248731600, "line_mean": 40.114379085, "line_max": 98, "alpha_frac": 0.7449328352, "autogenerated": false, "ratio": 1.9637867790525247, "config_test": fal...
""" A StreamHandler that extracts messages from streams """ from __future__ import print_function from collections import defaultdict import sys import traceback from struct import unpack from .thrift_message import ThriftMessage class StreamContext(object): def __init__(self): self.bytes = b'' clas...
{ "repo_name": "pinterest/thrift-tools", "path": "thrift_tools/stream_handler.py", "copies": "1", "size": "3659", "license": "apache-2.0", "hash": -1511092608695136500, "line_mean": 29.7478991597, "line_max": 82, "alpha_frac": 0.5285597158, "autogenerated": false, "ratio": 4.473105134474328, "co...
""" A StreamHandler that extracts messages from streams """ from __future__ import print_function from collections import defaultdict import sys import traceback from .thrift_message import ThriftMessage class StreamContext(object): def __init__(self): self.bytes = '' class StreamHandler(object): ...
{ "repo_name": "shrijeet/thrift-tools", "path": "thrift_tools/stream_handler.py", "copies": "1", "size": "3281", "license": "apache-2.0", "hash": 5208742186786485000, "line_mean": 30.854368932, "line_max": 82, "alpha_frac": 0.5352026821, "autogenerated": false, "ratio": 4.488372093023256, "confi...
"""A streaming dataflow pipeline to count pub/sub messages. """ from __future__ import absolute_import import argparse import logging from datetime import datetime from past.builtins import unicode import apache_beam as beam import apache_beam.transforms.window as window from apache_beam.examples.wordcount import W...
{ "repo_name": "GoogleCloudPlatform/training-data-analyst", "path": "courses/machine_learning/deepdive/04_advanced_preprocessing/taxicab_traffic/streaming_count.py", "copies": "2", "size": "2620", "license": "apache-2.0", "hash": 6457042269957237000, "line_mean": 33.038961039, "line_max": 115, "alpha_...
# a string consisting of characters that are valid identifiers in both # Python 2 and Python 3 import string valid_ident = string.ascii_letters + string.digits + "_" def str_to_identifier(s): """Convert a "bytes" to a valid (in Python 2 and 3) identifier.""" # convert str/bytes to unicode string s = s.de...
{ "repo_name": "marcecj/faust_python", "path": "FAUSTPy/python_ui.py", "copies": "1", "size": "14040", "license": "mit", "hash": -5792233573113185000, "line_mean": 34.5443037975, "line_max": 104, "alpha_frac": 0.5908831909, "autogenerated": false, "ratio": 3.9239798770262717, "config_test": fals...
####elise@fnal.gov ########## import numpy as np import scipy.stats import sys from sklearn.covariance import GraphLassoCV, ledoit_wolf #import os #sys.path.append(os.getcwd()) import six from .myutils import * from .tolerance import * from .variance import * from .priors import * from .model import * from .io_utils...
{ "repo_name": "EliseJ/astroABC", "path": "astroabc/abc_class.py", "copies": "1", "size": "18205", "license": "mit", "hash": 8122778185513432000, "line_mean": 47.1613756614, "line_max": 174, "alpha_frac": 0.4697610547, "autogenerated": false, "ratio": 4.426209579382446, "config_test": false, "...
#!/astro/apps/pkg/python/bin/python import numpy import pyfits import pylab import os class SDSSfits: def __init__(self,SDSS_fitfile = None,LINES=[]): self.spectrum = None self.D = {} self.z = 0 self.coeff0 = 0 self.coeff1 = 0 self.name = "" if SD...
{ "repo_name": "excelly/xpy-ml", "path": "sdss/jake_lib/SDSSfits.py", "copies": "1", "size": "8209", "license": "apache-2.0", "hash": 7622193906198012000, "line_mean": 31.1921568627, "line_max": 84, "alpha_frac": 0.4814228286, "autogenerated": false, "ratio": 3.3020917135961385, "config_test": f...
#!/astro/apps/pkg/python/bin/python import numpy import pylab from matplotlib import ticker#, axes3d import pyfits import os def S(theta): """ returns x,y a 2-dimensional S-shaped function for theta ranging from 0 to 1 """ t = 3*numpy.pi * (theta-0.5) x = numpy.sin(t) y = numpy.s...
{ "repo_name": "excelly/xpy-ml", "path": "sdss/jake_lib/tools.py", "copies": "1", "size": "10932", "license": "apache-2.0", "hash": 7038385707113477000, "line_mean": 24.7830188679, "line_max": 88, "alpha_frac": 0.5075009147, "autogenerated": false, "ratio": 3.275014979029359, "config_test": fals...
#!/astro/apps/pkg/python/bin/python import pyfits import SDSSfits import numpy from tools import create_fits import os def main(OUT_DIR = "/astro/net/scratch1/vanderplas/SDSS_GAL_RESTFRAME/", DIR_ROOT = "/astro/net/scratch1/sdssspec/spectro/1d_26/*/1d", LINES_FILE = "LINES_SHORT.TXT", ...
{ "repo_name": "excelly/xpy-ml", "path": "sdss/jake_lib/make_condensed_fits.py", "copies": "1", "size": "4199", "license": "apache-2.0", "hash": -4041813316859034000, "line_mean": 31.8046875, "line_max": 80, "alpha_frac": 0.5103596094, "autogenerated": false, "ratio": 3.408279220779221, "config_...
# A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). # # Find all strobogrammatic numbers that are of length = n. # # For example, # Given n = 2, return ["11","69","88","96"]. # # Hint: # # Try to use recursion and notice that it should recurse with n - 2 instead ...
{ "repo_name": "jigarkb/Programming", "path": "LeetCode/247-M-StrobogrammaticNumberII.py", "copies": "2", "size": "1965", "license": "mit", "hash": 9219716216263987000, "line_mean": 28.7727272727, "line_max": 108, "alpha_frac": 0.4254452926, "autogenerated": false, "ratio": 3.8529411764705883, "...
# Astrocrash01 # Get asteroids moving on the screen import random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Asteroid(games.Sprite): """ An asteroid which floats across the screen. """ SMALL = 1 MEDIUM = 2 LARGE = 3 images = {SMALL : games.lo...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash01.py", "copies": "1", "size": "1753", "license": "mit", "hash": -9193152681968067000, "line_mean": 26.8253968254, "line_max": 81, "alpha_frac": 0.5750142613, "autogenerated": false, "ratio": 3.390715667311412, ...
# Astrocrash02 # Get asteroids moving on the screen import random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Asteroid(games.Sprite): """ An asteroid which floats across the screen. """ SMALL = 1 MEDIUM = 2 LARGE = 3 images = {SMALL : games.lo...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash02.py", "copies": "1", "size": "2334", "license": "mit", "hash": 6989870555527336000, "line_mean": 27.4634146341, "line_max": 81, "alpha_frac": 0.5711225364, "autogenerated": false, "ratio": 3.3973799126637556, ...
# Astrocrash03 # Get ship moving import math, random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Asteroid(games.Sprite): """ An asteroid which floats across the screen. """ SMALL = 1 MEDIUM = 2 LARGE = 3 images = {SMALL : games.load_image("ast...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash03.py", "copies": "1", "size": "3170", "license": "mit", "hash": -6622120055722393000, "line_mean": 28.6261682243, "line_max": 81, "alpha_frac": 0.5665615142, "autogenerated": false, "ratio": 3.4835164835164836, ...
# Astrocrash04 # Get ship firing missiles import math, random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Asteroid(games.Sprite): """ An asteroid which floats across the screen. """ SMALL = 1 MEDIUM = 2 LARGE = 3 images = {SMALL : games.load_i...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash04.py", "copies": "1", "size": "4958", "license": "mit", "hash": -8554937211707166000, "line_mean": 29.2317073171, "line_max": 81, "alpha_frac": 0.5586930214, "autogenerated": false, "ratio": 3.5138199858256556, ...
# Astrocrash05 # Limiting missile fire rate import math, random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Asteroid(games.Sprite): """ An asteroid which floats across the screen. """ SMALL = 1 MEDIUM = 2 LARGE = 3 images = {SMALL : games.load...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash05.py", "copies": "1", "size": "5336", "license": "mit", "hash": 4815450428095640000, "line_mean": 29.8439306358, "line_max": 81, "alpha_frac": 0.5629685157, "autogenerated": false, "ratio": 3.4784876140808345, ...
# Astrocrash06 # Handling collisions import math, random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Asteroid(games.Sprite): """ An asteroid which floats across the screen. """ SMALL = 1 MEDIUM = 2 LARGE = 3 images = {SMALL : games.load_image(...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash06.py", "copies": "1", "size": "6341", "license": "mit", "hash": 8866004333180221000, "line_mean": 30.0833333333, "line_max": 81, "alpha_frac": 0.5505440782, "autogenerated": false, "ratio": 3.6048891415577033, ...
# Astrocrash07 # Add explosions import math, random from livewires import games games.init(screen_width = 640, screen_height = 480, fps = 50) class Wrapper(games.Sprite): """ A sprite that wraps around the screen. """ def update(self): """ Wrap sprite around screen. """ if self.top > gam...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash07.py", "copies": "1", "size": "6701", "license": "mit", "hash": 897210329740537500, "line_mean": 31.0622009569, "line_max": 81, "alpha_frac": 0.5420086554, "autogenerated": false, "ratio": 3.6241211465657113, "...
# Astrocrash08 # Add Game object for complete program import math, random from livewires import games, color games.init(screen_width = 640, screen_height = 480, fps = 50) class Wrapper(games.Sprite): """ A sprite that wraps around the screen. """ def update(self): """ Wrap sprite around screen. """ ...
{ "repo_name": "bohdan-shramko/learning-python", "path": "source/chapter12/astrocrash08.py", "copies": "1", "size": "10681", "license": "mit", "hash": -9032661210230572000, "line_mean": 32.0681114551, "line_max": 81, "alpha_frac": 0.5066005056, "autogenerated": false, "ratio": 3.9196330275229356, ...
"""Astroid hooks for the Python 2 GObject introspection bindings. Helps with understanding everything imported from 'gi.repository' """ import inspect import itertools import sys import re from astroid import MANAGER, AstroidBuildingException from astroid.builder import AstroidBuilder _inspected_modules = {} _ide...
{ "repo_name": "kevinkindom/chrome_depto_tools", "path": "third_party/logilab/astroid/brain/py2gi.py", "copies": "66", "size": "4619", "license": "bsd-3-clause", "hash": -1999952288602879500, "line_mean": 28.8, "line_max": 78, "alpha_frac": 0.5537995237, "autogenerated": false, "ratio": 4.05175438...
"""Astroid hooks for the Python 2 standard library. Currently help understanding of : * hashlib.md5 and hashlib.sha1 """ import sys from textwrap import dedent from astroid import ( MANAGER, AsStringRegexpPredicate, UseInferenceDefault, inference_tip, YES, InferenceError) from astroid import exceptions ...
{ "repo_name": "CoherentLabs/depot_tools", "path": "third_party/logilab/astroid/brain/py2stdlib.py", "copies": "1", "size": "11271", "license": "bsd-3-clause", "hash": 8189697102692949000, "line_mean": 33.0513595166, "line_max": 82, "alpha_frac": 0.5857510425, "autogenerated": false, "ratio": 4.22...
"""Astroid hooks for various builtins.""" import sys from functools import partial from textwrap import dedent import six from astroid import (MANAGER, UseInferenceDefault, inference_tip, YES, InferenceError, UnresolvableName) from astroid import nodes from astroid.builder import AstroidBuilder ...
{ "repo_name": "Shouqun/node-gn", "path": "tools/depot_tools/third_party/logilab/astroid/brain/builtin_inference.py", "copies": "64", "size": "8170", "license": "mit", "hash": -4434270280445436400, "line_mean": 32.3469387755, "line_max": 76, "alpha_frac": 0.5955936353, "autogenerated": false, "rat...
"""AstronClientRepository module: contains the AstronClientRepository class""" from direct.directnotify import DirectNotifyGlobal from ClientRepositoryBase import ClientRepositoryBase from MsgTypes import * from direct.distributed.PyDatagram import PyDatagram from pandac.PandaModules import STUint16, STUint32 class A...
{ "repo_name": "toontownfunserver/Panda3D-1.9.0", "path": "direct/distributed/AstronClientRepository.py", "copies": "4", "size": "10641", "license": "bsd-3-clause", "hash": -127804528039695140, "line_mean": 38.4111111111, "line_max": 130, "alpha_frac": 0.6046424208, "autogenerated": false, "ratio"...
"""Astronomical and physics constants. This module complements constants defined in `astropy.constants`, with gravitational paremeters and radii. Note that `GM_jupiter` and `GM_neptune` are both referred to the whole planetary system gravitational parameter. Unless otherwise specified, gravitational and mass paramet...
{ "repo_name": "anhiga/poliastro", "path": "src/poliastro/constants.py", "copies": "1", "size": "7113", "license": "mit", "hash": 1182490510246761000, "line_mean": 58.2352941176, "line_max": 119, "alpha_frac": 0.6876152646, "autogenerated": false, "ratio": 2.7938961553705908, "config_test": fals...
"""Astronomical coordinate functions.""" # p2.6+ compatibility from __future__ import division, print_function, unicode_literals try: unicode except NameError: unicode = basestring = str xrange = range import re import numpy as np from numpy.core.records import fromarrays from math import pi, cos DEG_PER...
{ "repo_name": "nhmc/LAE", "path": "python_modules/barak/coord.py", "copies": "1", "size": "13180", "license": "mit", "hash": 8158020738421736000, "line_mean": 28.5515695067, "line_max": 76, "alpha_frac": 0.5662367223, "autogenerated": false, "ratio": 3.3082329317269075, "config_test": false, ...
"""Astronomical observations calculations. """ import numpy as np from zcode.constants import PC, SPLC # VEGA/Johnson/Bessell: http://web.ipac.caltech.edu/staff/fmasci/home/astro_refs/magsystems.pdf # SDSS/AB/Fukugita: http://www.astronomy.ohio-state.edu/~martini/usefuldata.html # These wavelengths are in [cm] BAND...
{ "repo_name": "lzkelley/zcode", "path": "zcode/astro/obs.py", "copies": "1", "size": "5441", "license": "mit", "hash": 7870281733342599000, "line_mean": 26.3417085427, "line_max": 95, "alpha_frac": 0.5353795258, "autogenerated": false, "ratio": 2.5096863468634685, "config_test": false, "has_n...
""" Astronomy related functions """ from functools import wraps import numpy as np try: import dask except ImportError: dask = None def dask_compatibility(fn): """ Make functions transparent to using dask delayed objects """ @wraps(fn) def wrapped(*args, **kwargs): try: retur...
{ "repo_name": "mfouesneau/ezdata", "path": "ezdata/astro/astro.py", "copies": "1", "size": "12200", "license": "mit", "hash": -730383231188295400, "line_mean": 29.3482587065, "line_max": 79, "alpha_frac": 0.5832786885, "autogenerated": false, "ratio": 3.881641743557111, "config_test": false, ...
""" Astropy coordinate class for the Magellanic Stream coordinate system """ from astropy.coordinates.matrix_utilities import (rotation_matrix, matrix_product, matrix_transpose) from astropy.coordinates.baseframe import...
{ "repo_name": "adrn/gala", "path": "gala/coordinates/magellanic_stream.py", "copies": "2", "size": "4143", "license": "mit", "hash": 4092217780422355500, "line_mean": 39.2233009709, "line_max": 84, "alpha_frac": 0.6401158581, "autogenerated": false, "ratio": 3.7324324324324323, "config_test": f...
""" Astropy coordinate class for the Ophiuchus coordinate system """ # Third-party import numpy as np import astropy.units as u import astropy.coordinates as coord from astropy.coordinates import frame_transform_graph from astropy.coordinates.matrix_utilities import matrix_transpose __all__ = ["OphiuchusPriceWhelan1...
{ "repo_name": "adrn/gary", "path": "gala/coordinates/oph.py", "copies": "2", "size": "4558", "license": "mit", "hash": 2245724480375179300, "line_mean": 40.8165137615, "line_max": 83, "alpha_frac": 0.6772707328, "autogenerated": false, "ratio": 3.869269949066214, "config_test": false, "has_no...