text stringlengths 0 1.05M | meta dict |
|---|---|
# 1
# digit.each { |row| row[1, 1] = row[1, 1] * scale }
# digit.each do |row|
# if row =~ /\|/
# scale.times { puts row }
# else
# puts row
# end
# end
# 2
# class LCD
# attr_accessor( :size, :spacing )
# #
# # This hash is used to define the segment display for the
# # given digit. E... | {
"repo_name": "chrisortman/CIS-121",
"path": "k0459866/Extra_Credit/extra_credit01.py",
"copies": "1",
"size": "4703",
"license": "mit",
"hash": -2118607783031687400,
"line_mean": 25.5706214689,
"line_max": 118,
"alpha_frac": 0.391877525,
"autogenerated": false,
"ratio": 2.9879288437102924,
"co... |
## 1. Neural networks and iris flowers ##
import pandas
import matplotlib.pyplot as plt
import numpy as np
# Read in dataset
iris = pandas.read_csv("iris.csv")
# shuffle rows
shuffled_rows = np.random.permutation(iris.index)
iris = iris.loc[shuffled_rows,:]
print(iris.head())
# There are 2 species
print(iris.speci... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Machine learning Intermediate/Introduction to neural networks-121.py",
"copies": "1",
"size": "8043",
"license": "mit",
"hash": -224951887183269150,
"line_mean": 29.7022900763,
"line_max": 97,
"alpha_frac": 0.6374487132,
"autogenerated":... |
#1
# foo = None
# print (foo)
# print ("test {}.".format(foo))
# foo = 1.0
# print (foo)
# print ("test {}.".format(foo))
# print ("test __str__() {}.".format(foo.__str__()))
import osisoftpy # main package
import time
import dateutil.parser
import datetime
import pytz
import json
# webapi = osisoftpy.webapi('h... | {
"repo_name": "dstcontrols/osisoftpy",
"path": "examples/test.py",
"copies": "1",
"size": "5820",
"license": "apache-2.0",
"hash": 5977455616298648000,
"line_mean": 31.1602209945,
"line_max": 163,
"alpha_frac": 0.6383161512,
"autogenerated": false,
"ratio": 3.1716621253405997,
"config_test": fa... |
# 1.
from merlin import Merlin
engine = Merlin(
company = 'my_company',
environment = 'prod',
instance = 'my_instance'
)
# 2.
from merlin.search import Search
with engine(Search(q="dress")) as results:
print results
# 3. A query where we want 50 results starting from the 100th result
s = Sea... | {
"repo_name": "blackbirdtech/merlin-python",
"path": "examples/examples.py",
"copies": "1",
"size": "2957",
"license": "apache-2.0",
"hash": -1665897848235380700,
"line_mean": 21.0671641791,
"line_max": 72,
"alpha_frac": 0.6168413933,
"autogenerated": false,
"ratio": 3.032820512820513,
"config_... |
class Molecule():
def parse(self,argv):
return parse_molecule(argv)
class MoleculeNew(Molecule):
def parse(self,argv):
Dic = super().parse(argv)
# print(Dic)
total = 0
for num in Dic.values():
total+=int(num)
percentDic = {}
for e in Dic:
... | {
"repo_name": "YenCChien/sss",
"path": "PythonTest1.py",
"copies": "1",
"size": "3862",
"license": "mpl-2.0",
"hash": -8142365641684140000,
"line_mean": 36.862745098,
"line_max": 139,
"alpha_frac": 0.5590367685,
"autogenerated": false,
"ratio": 2.954858454475899,
"config_test": false,
"has_no... |
# 1 ---------
# A simple test of the basic_aep model
from fusedwind.plant_flow.basic_aep import aep_weibull_assembly
import numpy as np
aep = aep_weibull_assembly()
# 1 ---------
# 2 ---------
# Set input parameters
aep.wind_curve = np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, \
... | {
"repo_name": "FUSED-Wind/fusedwind",
"path": "docs/examples/Fused_flow_docs_example.py",
"copies": "2",
"size": "1168",
"license": "apache-2.0",
"hash": -3791004480347205000,
"line_mean": 28.2,
"line_max": 123,
"alpha_frac": 0.5556506849,
"autogenerated": false,
"ratio": 2.3037475345167655,
"c... |
"""1
Revision ID: 275df1efccf
Revises: None
Create Date: 2014-03-28 19:37:49.676179
"""
# revision identifiers, used by Alembic.
revision = '275df1efccf'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create... | {
"repo_name": "SuperQuest/v1",
"path": "migrations/versions/275df1efccf_1.py",
"copies": "1",
"size": "6532",
"license": "mit",
"hash": -4899360255028525000,
"line_mean": 44.0482758621,
"line_max": 85,
"alpha_frac": 0.6576852419,
"autogenerated": false,
"ratio": 3.437894736842105,
"config_test"... |
# 1.
print_log('\n1. Creates a new local pool ledger configuration that is used '
'later when connecting to ledger.\n')
pool_config = json.dumps({'genesis_txn': genesis_file_path})
try:
await pool.create_pool_ledger_config(pool_name, pool_config)
exc... | {
"repo_name": "anastasia-tarasova/indy-sdk",
"path": "docs/how-tos/issue-credential/python/step2.py",
"copies": "2",
"size": "4833",
"license": "apache-2.0",
"hash": -1418943095994416000,
"line_mean": 48.3163265306,
"line_max": 151,
"alpha_frac": 0.5495551417,
"autogenerated": false,
"ratio": 3.9... |
# 1.
print_log('\n1. Creates Issuer wallet and opens it to get handle.\n')
await
wallet.create_wallet(pool_name, issuer_wallet_name, None, None, None)
issuer_wallet_handle = await
wallet.open_wallet(issuer_wallet_name, None, None)
# 2.
print_log('\n2. Cre... | {
"repo_name": "anastasia-tarasova/indy-sdk",
"path": "docs/how-tos/negotiate-proof/python/step2.py",
"copies": "2",
"size": "2916",
"license": "apache-2.0",
"hash": -7977980992390937000,
"line_mean": 39.5138888889,
"line_max": 111,
"alpha_frac": 0.5696159122,
"autogenerated": false,
"ratio": 3.53... |
# 1.
# Реализовать предобусловленный метод сопряженных градиентов для систем с матрицами Стилтьеса
# с предобуславливанием по методам ILU(k), MILU(k) и ILU(k,e)
#
# (в последнем случае речь идёт об алгоритме ILU(k), в котором портрет матрицы заменён на множетсов пар индексов,
# включающее пары равных индексов и пары и... | {
"repo_name": "maxmalysh/congenial-octo-adventure",
"path": "mod2/task1.py",
"copies": "1",
"size": "8263",
"license": "unlicense",
"hash": -5245663431171793000,
"line_mean": 29.3609958506,
"line_max": 116,
"alpha_frac": 0.5433921006,
"autogenerated": false,
"ratio": 2.316972767574414,
"config_... |
#1
#v 0.001
def _ERROR(Message,Function):
import sys,traceback
i=sys.exc_info();T=traceback.extract_tb(i[2])[0]
print '-----'
print 'Recall: '+Function
print
print 'File: '+T[0].split('\\')[-1]+', line '+str(T[1])
print "Code: '"+T[3]+"'"
print traceback.format_exception_only(i[0], i[1... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data (scrapped dev5 attempt)/ERROR.py",
"copies": "2",
"size": "1218",
"license": "mit",
"hash": -6150143610555806000,
"line_mean": 31.0526315789,
"line_max": 84,
"alpha_frac": 0.723316913,
"autogenerated": false,
"ra... |
#1
#v 0.001
from ERROR import *
from LOGGING import LOG as __LOG
import COMMON
"""
- SetMatNode(): TODO
###
these are extremely complicated and will take quite a while to solve
(this means no color animations, ramps or special effects unachievable bt the shader alone)
---
(a material must be active in a Mesh-type Ob... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "data/FORMAT.py",
"copies": "1",
"size": "33654",
"license": "mit",
"hash": 6892526838806766000,
"line_mean": 47.5627705628,
"line_max": 143,
"alpha_frac": 0.5560706008,
"autogenerated": false,
"ratio": 3.3124015748031495,
"config_test"... |
#1
#v 0.001
from ERROR import *
"""
TODO's:
- SetLight():
###
I have to learn about these a little more :P
"""
#global public usage variables:
global UGE_POINTS,UGE_LINES,UGE_LINESTRIP,UGE_LINELOOP,UGE_TRIANGLES,UGE_TRIANGLESTRIP,UGE_TRIANGLEFAN,UGE_QUADS,UGE_QUADSTRIP,UGE_POLYGON
UGE_POINTS,UGE_LINES,UGE_LINESTRIP... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data (scrapped dev5 attempt)/FORMAT.py",
"copies": "1",
"size": "32810",
"license": "mit",
"hash": 4522680218362861000,
"line_mean": 50.4263322884,
"line_max": 159,
"alpha_frac": 0.5353245962,
"autogenerated": false,
... |
#1
#v 0.001
#I don't have a TOC here yet as everything constantly changes
import COMMON #file vars and functions for import/export processing
import VIEWER #mainly for the toggles
from VIEWER import __GL,__GLU #GL functions
from VIEWER import __pyg
'''
from COMMON import Scripts
#Shapes (private)
#Widgets (privat... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data (scrapped dev5 attempt)/GUI_update.py",
"copies": "1",
"size": "17612",
"license": "mit",
"hash": -5439508331457262000,
"line_mean": 32.7413793103,
"line_max": 142,
"alpha_frac": 0.5642743584,
"autogenerated": fals... |
#1
#v 0.001
import COMMON #file vars and functions for import/export processing
import VIEWER #mainly for the toggles
from VIEWER import __GL,__GLU#,__GLUT #GL functions
'''
from COMMON import Scripts
#Shapes (private)
#Widgets (private)
def Button(Text,X,Y,W,H,): pass
def Browser():
import os
Dir='C:/';... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data backups/GUI_dev45_port.py",
"copies": "1",
"size": "10228",
"license": "mit",
"hash": 3866764479750810000,
"line_mean": 30.3742331288,
"line_max": 129,
"alpha_frac": 0.6143918655,
"autogenerated": false,
"ratio":... |
#1
#v 0.001
import COMMON #file vars and functions for import/export processing
import VIEWER #mainly for the toggles
from VIEWER import __GL,__GLU,__pyg
from array import array as __arr
class __Widget:
class _event:
def __init__(self):
self.gainFocus=False #True for the first frame the curs... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data (scrapped dev5 attempt)/GUI_last.py",
"copies": "1",
"size": "32956",
"license": "mit",
"hash": -278279484921126660,
"line_mean": 34.590712743,
"line_max": 142,
"alpha_frac": 0.5989197718,
"autogenerated": false,
... |
#1
#v 0.001
import COMMON,sys; sys.path.append('data')
#TODO: remove:
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL import GL as __GL, GLU as __GLU
import ArcBall as __AB, pygame as __pyg
from pygame.locals import * #TODO: localize
from LOGGING import LOG as __LOG, WRITE_LOG as __WLOG #will be moved ... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data (scrapped dev5 attempt)/VIEWER.py",
"copies": "1",
"size": "38649",
"license": "mit",
"hash": -388916875545100900,
"line_mean": 44.4171562867,
"line_max": 223,
"alpha_frac": 0.5161323708,
"autogenerated": false,
... |
#1
#v 0.001
import sys; #sys.path.append('data')
import COMMON
#TODO: remove:
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL import GL as __GL, GLU as __GLU
import Python.ArcBall as __AB, pygame as __pyg
from pygame.locals import * #TODO: localize
from tkFileDialog import askopenfilename,asksaveasfilen... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "data/VIEWER.py",
"copies": "1",
"size": "55702",
"license": "mit",
"hash": 5523323525696215000,
"line_mean": 50.1976102941,
"line_max": 211,
"alpha_frac": 0.486391871,
"autogenerated": false,
"ratio": 2.848624322389281,
"config_test": ... |
#1
#v 0.001
'''
description:
UMC's GUI, instead of using the GL Feedback Buffer like any normal GUI,
uses it's own interface based on hitdefs.
how it works is it fills 2 buffers with data:
- Widgets:
holds the widget data (info), event states, and hitdef
- layer:
holds a complex arrangement of polygon layer... | {
"repo_name": "Universal-Model-Converter/UMC3.0a",
"path": "dev tests and files/data (scrapped dev5 attempt)/GUI_new.py",
"copies": "1",
"size": "54979",
"license": "mit",
"hash": 4800527526848586000,
"line_mean": 37.9376770538,
"line_max": 175,
"alpha_frac": 0.6085778206,
"autogenerated": false,
... |
""" 1: Object-Oriented Programming
Some examples of Object-Oriented programming with
Python
thomas moll 2015
"""
class Vehicle(object):
number_of_wheels = None
def __init__(self, name):
self.name = name
def __str__(self):
return 'Type: '+str(self.__class__)+' Name... | {
"repo_name": "ston380/Data-Structure-Zoo",
"path": "0-Object-Oriented Programming/objects.py",
"copies": "15",
"size": "1090",
"license": "mit",
"hash": 8236681032901480000,
"line_mean": 21.6956521739,
"line_max": 77,
"alpha_frac": 0.5587155963,
"autogenerated": false,
"ratio": 3.797909407665505... |
#~ 1) On line 50 set the server name, at line 54 set hostname, institution, sharedsecret and id (from user management / shared secret)
#~ 2) From cmd c:\python25\python.exe impersonate_generic.py (or F5 from SciTE)
#~ - this will set up a webserver on your machine on port 8000 for the impersonation
#~ 3) Start up a bro... | {
"repo_name": "equella/Equella",
"path": "Source/Tools/ImportLibraries/Python/impersonate_generic.py",
"copies": "1",
"size": "2020",
"license": "apache-2.0",
"hash": -8269958338410626000,
"line_mean": 32.6666666667,
"line_max": 190,
"alpha_frac": 0.6846534653,
"autogenerated": false,
"ratio": 3.... |
# 1 = only crash errors
# 2 = error + warning
# 3 = All output
error_level = 3
repository = r"C:\tmp\VBad"
#functions available : onClose, onOpen
auto_function_macro = "onOpen"
trigger_close_test_value="True"
trigger_close_test_name = "toto"
#methods available: variables
key_hiding_method = "variable"
... | {
"repo_name": "Pepitoh/VBad",
"path": "const.py",
"copies": "1",
"size": "2285",
"license": "mit",
"hash": -8275678165686918000,
"line_mean": 41.1132075472,
"line_max": 170,
"alpha_frac": 0.7207877462,
"autogenerated": false,
"ratio": 3.2183098591549295,
"config_test": false,
"has_no_keywords... |
#1 origional size images, limited to 100 images per page
#1.1 Added links to the bottom of the page to progress through the galleries
#1.2 Resized the images to 200x200 and increased the images to 400 per page
#2 Added logic to chew through the XML files. The program will now go through all the g.sitemap.xxx.xml files.... | {
"repo_name": "AlecWallace2001/PBPull",
"path": "PBPull.py",
"copies": "1",
"size": "5411",
"license": "mit",
"hash": 825556795791383200,
"line_mean": 43.3524590164,
"line_max": 319,
"alpha_frac": 0.5634817963,
"autogenerated": false,
"ratio": 3.4954780361757107,
"config_test": false,
"has_no... |
## 1. Overview ##
f = open("dictionary.txt", "r")
vocabulary = f.read()
print(vocabulary)
## 2. Tokenizing the Vocabulary ##
vocabulary = open("dictionary.txt", "r").read()
tokenized_vocabulary = vocabulary.split(" ")
print(tokenized_vocabulary[0:5])
## 3. Replacing Special Characters ##
f = open("story.txt", 'r'... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Beginner/Introduction to Functions-4.py",
"copies": "1",
"size": "4282",
"license": "mit",
"hash": -4019859173405880000,
"line_mean": 31.2030075188,
"line_max": 63,
"alpha_frac": 0.6742176553,
"autogenerated": false,
... |
# 1. p:camera The first query returns all records that have the term camera in the product title.
# 2. r:great The second query return all records that have the term great in the review summary or text.
# 3. camera The third query returns all records that have the term camera in one of the fields product title, revie... | {
"repo_name": "quentinlautischer/291MiniProject2",
"path": "src/phase3.py",
"copies": "1",
"size": "15532",
"license": "apache-2.0",
"hash": -8887391866331831000,
"line_mean": 34.3,
"line_max": 541,
"alpha_frac": 0.4709631728,
"autogenerated": false,
"ratio": 3.997940797940798,
"config_test": f... |
"""1.Phase"""
from sympy import *
init_printing()
z, x0, x1, x2, x3, x4, x5, x6, x7 = symbols('z, x0, x1, x2, x3, x4, x5, x6, x7')
B = [x3, x4, x5, x6, x7]
N = [x0, x1, x2]
rows = [Eq(x3, -12 + 2 * x1 + 1 * x2 + x0),
Eq(x4, -12 + x1 + 2 * x2 + x0),
Eq(x5, -10 + x1 + x2 + x0),
Eq(... | {
"repo_name": "mazenbesher/simplex",
"path": "sympy_version/specific/blatt4_aufgabe2_hilfsproblem.py",
"copies": "1",
"size": "2412",
"license": "mit",
"hash": -7098804157126376000,
"line_mean": 32.0410958904,
"line_max": 85,
"alpha_frac": 0.5182421227,
"autogenerated": false,
"ratio": 2.82766705... |
"""1. Police department uploads the video to S3 bucket for incoming videos
2. As video are saved in the bucket a threaded script creates an EC2 instance per item in bucket
3. The threaded script sends a command over SSH with the argument being the key name of the video on the S3 bucket
4. The called script then saves ... | {
"repo_name": "policevideorequests/policevideopublisher",
"path": "run_single_instance_strategy.py",
"copies": "1",
"size": "2756",
"license": "bsd-3-clause",
"hash": 1226418485367766000,
"line_mean": 52,
"line_max": 162,
"alpha_frac": 0.6509433962,
"autogenerated": false,
"ratio": 3.790921595598... |
## 1. Probability basics ##
# Print the first two rows of the data.
print(flags[:2])
most_bars_country = flags['name'][flags['bars'].idxmax()]
highest_population_country = flags['name'][flags['population'].idxmax()]
## 2. Calculating probability ##
total_countries = flags.shape[0]
orange_probability = len(flags[flag... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Probability Statistics Intermediate/Introduction to probability-48.py",
"copies": "1",
"size": "1924",
"license": "mit",
"hash": -3860584104712697000,
"line_mean": 29.078125,
"line_max": 96,
"alpha_frac": 0.6548856549,
"autogenerated": f... |
#1. Put strings into a list, then use ' '.join(strings)
# to concate all strings
strings = ["Hello", "World", "You", "!"]
name = ' '.join(strings)
print name
#2. Always use an object's capabilities instead of restrained to its type.
#3. Use if not x:
x = 10
if not x:
print name
#4. Use string.function()
if name... | {
"repo_name": "martinggww/lucasenlights",
"path": "MachineLearning/PythonIdioms.py",
"copies": "1",
"size": "1396",
"license": "cc0-1.0",
"hash": 3439500107487517000,
"line_mean": 20.8125,
"line_max": 74,
"alpha_frac": 0.6511461318,
"autogenerated": false,
"ratio": 3.088495575221239,
"config_te... |
# 1. Read the names of the json files from the directory;
# 2. Print out the json file names.
# Import packages:
import os
import glob
import magic
import json
# Set the working directory to the new GrEx. Print the working directory to confirm:
path = 'C:\\Users\Stephan\Desktop\GrEx3'
os.chdir(path)
print(os.getcwd()... | {
"repo_name": "sgranitz/nw",
"path": "predict420/dne5.py",
"copies": "2",
"size": "1576",
"license": "mit",
"hash": -7167821400173000000,
"line_mean": 27.6545454545,
"line_max": 98,
"alpha_frac": 0.6840101523,
"autogenerated": false,
"ratio": 3.283333333333333,
"config_test": false,
"has_no_k... |
## 1. Recap ##
import pandas as pd
import matplotlib.pyplot as plt
unrate = pd.read_csv('unrate.csv')
unrate['DATE'] = pd.to_datetime(unrate['DATE'])
plt.plot(unrate['DATE'].head(12),unrate['VALUE'].head(12))
plt.xticks(rotation=90)
plt.xlabel('Month')
plt.ylabel('Unemployment Rate')
plt.title('Monthly Unemployment T... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Exploratory Data Visualization/Multiple plots-216.py",
"copies": "1",
"size": "2691",
"license": "mit",
"hash": -3005192965135424000,
"line_mean": 26.1919191919,
"line_max": 80,
"alpha_frac": 0.6358231141,
"autogenerated": false,
"rati... |
# 1. Reebok is designing a new type of Crossfit shoe, the Nano X. The fixed cost for the
# production will be $24,000. The variable cost will be $36 per pair of shoes. The shoes will
# sell for $107 for each pair. Using Python, graph the cost and revenue functions and
# determine how many pairs of sneakers will have to... | {
"repo_name": "sgranitz/northwestern",
"path": "predict400/ex1.py",
"copies": "2",
"size": "9866",
"license": "mit",
"hash": 4316507420852708000,
"line_mean": 32.1851851852,
"line_max": 100,
"alpha_frac": 0.6206371753,
"autogenerated": false,
"ratio": 2.6601889338731444,
"config_test": false,
... |
#1.
class LR_LinearDecay():
'''
Function : -Learning rate decay linearly(a constant factor) after each epoch
-Eg. LR= 5, 5.8, 5.6, 5.4, ........
'''
def __init__(self, min_lr=1e-5, max_lr=1e-2, epochs=None):
super().__init__()
self.min_lr = min_lr
... | {
"repo_name": "iamharshit/ML_works",
"path": "ALGOs/LearningRate_Decay.py",
"copies": "1",
"size": "4209",
"license": "mit",
"hash": -2420692056237894700,
"line_mean": 28.5,
"line_max": 127,
"alpha_frac": 0.5141363744,
"autogenerated": false,
"ratio": 3.402586903799515,
"config_test": false,
... |
#1.
def print_n(string, num):
count = 0
while count < num:
print string
count += 1
#2.
def bottles(num):
while num >= 1:
print '{} bottles of soda on the wall'.format(num)
print '{} bottles of soda'.format(num)
print 'Take one down, pass it around'
... | {
"repo_name": "Nethermaker/school-projects",
"path": "intro/while_practice.py",
"copies": "1",
"size": "2322",
"license": "mit",
"hash": -3711466855598380000,
"line_mean": 16,
"line_max": 76,
"alpha_frac": 0.4900947459,
"autogenerated": false,
"ratio": 3.935593220338983,
"config_test": false,
... |
#1
import pygame
from pygame.locals import*
import math
import random
import time
#2
shootInterval=15
shootTimer=0
badtimer=100
badtimer1=0
badguys=[]
healthvalue=194
acc=[0,0]
arrows=[]
keys=[False,False,False,False]
autoshoot=False
playerpos=[100,100]
pygame.init()
width,height=1000,750
screen=pyg... | {
"repo_name": "milkmeat/thomas",
"path": "rabbit game/game.py",
"copies": "1",
"size": "6710",
"license": "mit",
"hash": -2836063987357558000,
"line_mean": 29.6509433962,
"line_max": 147,
"alpha_frac": 0.5812220566,
"autogenerated": false,
"ratio": 3.068129858253315,
"config_test": false,
"ha... |
# 1. Select 4 bounding boxes around each dot
# 2. For each frame:
# a. search some radius around the bounding box
# b. select a new bounding box from your search such that the SDD is minimized
# c. compute projective transformation based on the centers of each bounding box
# d. warp an image using that ... | {
"repo_name": "JasonKraft/CVFall2017",
"path": "hw3/problem2.py",
"copies": "1",
"size": "4907",
"license": "mit",
"hash": -5599516873562585000,
"line_mean": 35.0882352941,
"line_max": 153,
"alpha_frac": 0.6574281638,
"autogenerated": false,
"ratio": 3.0048989589712187,
"config_test": true,
"... |
### (-1). Setup
import json
from rhine.instances import *
from rhine.datatypes import *
from rhine.functions import *
client = instantiate('CEFPUFKMUVJBNZMFUOPOLZEOM') # This API key will be disabled shortly after the demo - register your own for free at www.rhine.io.
### (0). Datasets
articles = json.loads(open('... | {
"repo_name": "Speare/rhine-python",
"path": "examples/demo.py",
"copies": "1",
"size": "2418",
"license": "bsd-3-clause",
"hash": 5204005192527133000,
"line_mean": 30.4025974026,
"line_max": 150,
"alpha_frac": 0.6807278743,
"autogenerated": false,
"ratio": 3.5043478260869567,
"config_test": fa... |
## 1. Shared Indexes ##
import pandas as pd
fandango = pd.read_csv('fandango_score_comparison.csv')
print(fandango.head(2))
print(fandango.index)
## 2. Using Integer Indexes to Select Rows ##
fandango = pd.read_csv('fandango_score_comparison.csv')
first_last = fandango.iloc[[0,len(fandango)-1]]
## 3. Using Custom I... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Data Analysis with Pandas Intermediate/Pandas Internals_ Dataframes-146.py",
"copies": "1",
"size": "1675",
"license": "mit",
"hash": 499692301594185900,
"line_mean": 31.2307692308,
"line_max": 132,
"alpha_frac": 0.7170149254,
"autogener... |
# 1. Size of vocabulary file
# 2. Name of vocabulary file
# 3. The input file name
# 4. The number of sentences in input file
# 5. The window size
# 6. The position from which I will start my work.
# 7. The name of the file to which I would write.
import sys, itertools
import struct
#import contextlib, mmap
vocab_size=... | {
"repo_name": "se4u/mvlsa",
"path": "src/extract_count/print_cooccurence_rows.py",
"copies": "1",
"size": "2203",
"license": "mit",
"hash": -3806868465127870500,
"line_mean": 39.7962962963,
"line_max": 95,
"alpha_frac": 0.5510667272,
"autogenerated": false,
"ratio": 3.5589660743134086,
"config_... |
# 1. Something that actually "writes" an integer to memory and can "read" an integer from a memory address
# 2. Value - something allowing us to get several integers from memory and interpret them as a thing, or
# write a thing out as several integers into memory
# 3. A specific type of value: "pointer". Interpretat... | {
"repo_name": "petersrinivasan/neopeng",
"path": "memory.py",
"copies": "1",
"size": "9719",
"license": "unlicense",
"hash": 2201304572703648500,
"line_mean": 31.9491525424,
"line_max": 117,
"alpha_frac": 0.6505813355,
"autogenerated": false,
"ratio": 3.323871409028728,
"config_test": false,
... |
# 1st Activation Function: sigmoid
# 2nd Activation Function: softmax
# Loss Function: Cross Entropy Loss
# Train Algorithm: Batch Gradient Descent
# Bias terms are used.
# force the result of divisions to be float numbers
from __future__ import division
# I/O Libraries
from os import listdir
from os.path import isfi... | {
"repo_name": "Iptamenos/NeuralNetworksInPython",
"path": "NeuralNetworksForSpamHamClassification/NN_SpamHam_CrossEntropy_batch_gradient_descent.py",
"copies": "1",
"size": "10475",
"license": "mit",
"hash": 6422883546722858000,
"line_mean": 34.5084745763,
"line_max": 128,
"alpha_frac": 0.6496420048,... |
# 1st Activation Function: sigmoid
# 2nd Activation Function: softmax
# Loss Function: Cross Entropy Loss
# Train Algorithm: Mini-batch Gradient Descent
# Bias terms are used.
# force the result of divisions to be float numbers
from __future__ import division
from pandas import DataFrame
import pandas as pd
# I/O Li... | {
"repo_name": "Iptamenos/NeuralNetworksInPython",
"path": "NeuralNetworksForSpamHamClassification/NN_SpamHam_CrossEntropy_minibatch_gradient_descent.py",
"copies": "1",
"size": "11193",
"license": "mit",
"hash": 8053661613906292000,
"line_mean": 34.309148265,
"line_max": 131,
"alpha_frac": 0.64647547... |
# 1st Activation Function: tanh
# 2nd Activation Function: softmax
# Maximum Likelihood Estimate Function: Cross Entropy Function
# Train Algorithm: Batch Gradient Ascent
# Bias terms are used.
# force the result of divisions to be float numbers
from __future__ import division
# import local python files
from read_mn... | {
"repo_name": "Iptamenos/NeuralNetworksInPython",
"path": "NeuralNetworkForMNIST/NN_mnist_batch_gradient_ascent.py",
"copies": "1",
"size": "8768",
"license": "mit",
"hash": 8023377186692413000,
"line_mean": 31.2352941176,
"line_max": 114,
"alpha_frac": 0.6203239051,
"autogenerated": false,
"rati... |
# 1. starting page of each topic: URL
# 2. fetch the URL list of each thread, download the thread page, parse, if more pages in thread, get more, parse
# 3. traverse the pages by changing URL, ?page=1
# read the first page
# parse, and get the thread list
# if the thread list is empty, terminate.
# else
# for loo... | {
"repo_name": "mzweilin/MP1",
"path": "part1/1.Crawler_MedHelp.py",
"copies": "1",
"size": "7698",
"license": "mit",
"hash": -2532184034337374700,
"line_mean": 32.7631578947,
"line_max": 161,
"alpha_frac": 0.5450766433,
"autogenerated": false,
"ratio": 3.6005612722170253,
"config_test": false,
... |
## 1. String Manipulation ##
hello = "hello world"[0:5]
foo = "some string"
password = "password"
print(foo[5:11])
# Your code goes here
fifth = password[4]
last_four = password[len(password)-4:]
## 2. Omitting starting or ending indices ##
hello = "hello world"[:5]
foo = "some string"
print(foo[5:])
my_string = ... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Advanced/Lambda functions-111.py",
"copies": "1",
"size": "2273",
"license": "mit",
"hash": 4366752827671356400,
"line_mean": 21.9696969697,
"line_max": 95,
"alpha_frac": 0.6616805983,
"autogenerated": false,
"ratio"... |
#1st step in updateing user collection. this script grabs distinct user id's from auctiondata collection
#and get basic character information for the user collection. after this scrip runs, userguild.py needs to run
import pymongo
from pymongo import MongoClient
from wowlib import wowapi, class_define
import tim... | {
"repo_name": "henkhaus/wow",
"path": "users.py",
"copies": "1",
"size": "2189",
"license": "apache-2.0",
"hash": 2342654360205922300,
"line_mean": 32.746031746,
"line_max": 112,
"alpha_frac": 0.5938784833,
"autogenerated": false,
"ratio": 3.8336252189141855,
"config_test": false,
"has_no_key... |
# 1st string inputs is called "debris", while 2nd string "product". Returns the 2nd input string as the output if all of its characters can be found in the 1st input string and "Give me something that's not useless next time." if it's impossible.
# Letters that are present in the 1st input string may be used as many t... | {
"repo_name": "roy2020china/BingDemo",
"path": "5_fix_machines.py",
"copies": "1",
"size": "2170",
"license": "mit",
"hash": 7689604325127216000,
"line_mean": 40.125,
"line_max": 247,
"alpha_frac": 0.619047619,
"autogenerated": false,
"ratio": 3.3457627118644067,
"config_test": false,
"has_no... |
## 1. Take a number of with four digits (N)
## 2. Sort digits small to big (ASC)
## 3. Sort digits big to small (DESC)
## 4. Result - DESC - ASC
## 5. If Result = N exit and record number of iterations
def sortAsc(n):
""" Sort the input number by characters from small to big"""
a = str(n)
b = sorted... | {
"repo_name": "fieraloca/CODEPROJ",
"path": "PYTHON/SCHOOL/recursive01.py",
"copies": "1",
"size": "2083",
"license": "mit",
"hash": -6580244275081094000,
"line_mean": 20.9263157895,
"line_max": 72,
"alpha_frac": 0.4613538166,
"autogenerated": false,
"ratio": 3.0542521994134897,
"config_test": ... |
# 1. TENSORS
# 1.1 WARM-UP: NUMPY
import numpy as np
# N is batch size; D_in is input dim
# H is hidden dim; D_out is output dim
N, D_in, H, D_out = 64, 1000, 100, 10
# Create random input and output data
x = np.random.randn(N, D_in)
y = np.random.randn(N, D_out)
# Randomly initialize weights
w1 = np.random.randn... | {
"repo_name": "WNoxchi/Kaukasos",
"path": "pytorch/pytorch_examples.py",
"copies": "1",
"size": "17742",
"license": "mit",
"hash": -5094468535600680000,
"line_mean": 31.5541284404,
"line_max": 80,
"alpha_frac": 0.6773193552,
"autogenerated": false,
"ratio": 3.448396501457726,
"config_test": fal... |
## 1. The Data Set ##
print(len(borrower_default_count_240))
print(borrower_default_count_240[0:10])
## 2. Built-In Functions ##
total = sum([11,6])
## 3. Overwriting a Built-In Function ##
sum = sum(borrower_default_count_240)
test = sum(principal_outstanding_240)
## 4. Scopes ##
def find_average(column):
... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Intermediate/Variable Scopes-29.py",
"copies": "1",
"size": "1345",
"license": "mit",
"hash": -3463054704487189500,
"line_mean": 18.7941176471,
"line_max": 86,
"alpha_frac": 0.692936803,
"autogenerated": false,
"rati... |
## 1. The Data Set ##
# Weather has been loaded in.
print(weather[0])
print(weather[-1])
## 3. Practice Populating a Dictionary ##
superhero_ranks = {}
superhero_ranks['Aquaman'] = 1
superhero_ranks['Superman'] = 2
## 4. Practice Indexing a Dictionary ##
president_ranks = {}
president_ranks["FDR"] = 1
president_ra... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Beginner/Dictionaries-167.py",
"copies": "1",
"size": "1834",
"license": "mit",
"hash": 7421986907022433000,
"line_mean": 23.7972972973,
"line_max": 94,
"alpha_frac": 0.6384950927,
"autogenerated": false,
"ratio": 2.... |
# 1)Thelo na anoikso ena .txt arxeio
# 2)Thelo na do ti exei
# 3)Thelo na grapso kati
# 4)Thelo na ksanakano print to arxeio na do ti egrapsa
# 5)Thelo na kleiso to arxeio
## Kano ena random noumero gia na graftei sto arxeio....isa isa gia tin dokimi
import random
randoms_word = random.randint(1,10)
# Dimiourgo tin ... | {
"repo_name": "alexsigaras/rover",
"path": "examples/write_test.py",
"copies": "1",
"size": "1109",
"license": "mit",
"hash": 6553177507049697000,
"line_mean": 31.6176470588,
"line_max": 78,
"alpha_frac": 0.6807935077,
"autogenerated": false,
"ratio": 2.437362637362637,
"config_test": false,
... |
## 1. The Time Module ##
import time
current_time = time.time()
print(current_time)
## 2. Converting Timestamps ##
import time
current_time = time.time()
current_struct_time = time.gmtime()
current_hour = current_struct_time.tm_hour
print(current_hour)
## 3. UTC ##
import datetime
current_datetime = datetime.date... | {
"repo_name": "vipmunot/Data-Analysis-using-Python",
"path": "Python Programming Intermediate/Dates in Python-166.py",
"copies": "1",
"size": "1410",
"license": "mit",
"hash": -7355587153028510000,
"line_mean": 20.0447761194,
"line_max": 99,
"alpha_frac": 0.685106383,
"autogenerated": false,
"rat... |
1. import pandas as pd
2. from sklearn.base import TransformerMixin
3.
4.
5. class FeatureExtractor(TransformerMixin):
6. main_cols = ['country', 'gender', 'ageMin', 'ageMax', 'year']
7. inci_cols = [
8. # Other cancers mortality rate
9. 'g_mNasopharynx (C11)', 'g_mBreast (C50)', 'g_... | {
"repo_name": "BenSchannes/Epidemium",
"path": "Feature_Extractor_NN_2.py",
"copies": "1",
"size": "1459",
"license": "mit",
"hash": -5392544926263482000,
"line_mean": 46.6333333333,
"line_max": 104,
"alpha_frac": 0.5812200137,
"autogenerated": false,
"ratio": 2.315873015873016,
"config_test": ... |
1、下载安装包
http://dev.mysql.com/downloads/mysql/#downloads
推荐下载通用安装方法的TAR包
http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar
2、检查库文件是否存在,如有删除。
[root@localhost Desktop]$ rpm -qa | grep mysql
mysql-libs-5.1.52-1.el6_0.1.x86_64
[root@localhost ~]# rpm -e mysql-libs-5.1.52.x86_64 --nodeps
[ro... | {
"repo_name": "yu757371316/MySQL",
"path": "yuzicheng/余子成/其他笔记文档/MySQL/配置和学习/Linux下MySQL的安装与配置.py",
"copies": "1",
"size": "10935",
"license": "apache-2.0",
"hash": 6691328430260427000,
"line_mean": 39.4713114754,
"line_max": 636,
"alpha_frac": 0.7352911392,
"autogenerated": false,
"ratio": 2.488... |
# 1、恐龙题
# 给两个cvs files里面给了一些数据,格式大概是这样的
# file1
# name,leg_length,diet
# file2:
# name,stride_length,stance
# 两个files里的恐龙的名字是对应的,但是不顺序
# 要求是根据给定的一个公式(输入是leg_length和stride_length)计算出速度,从大到小输出直立行走的恐龙名字
import collections
import os
def printDinosaur(speedOf, file1, file2):
dTable = collections.defaultdict(list)
with op... | {
"repo_name": "seanxwzhang/LeetCode",
"path": "Facebook/PE/dinosaur.py",
"copies": "1",
"size": "1278",
"license": "mit",
"hash": 8678646909809414000,
"line_mean": 29.1351351351,
"line_max": 87,
"alpha_frac": 0.6956912029,
"autogenerated": false,
"ratio": 2.1423076923076922,
"config_test": fals... |
#1.单进程:
# import requests,time
# start_time=time.time()
# [requests.get('http://www.liaoxuefeng.com/') for x in range(100)]
# print("用时:{}秒".format(time.time()-start_time))
#2.多线程
# import threadpool,requests
# def run(url):
# r=requests.get(url=url)
# pool=threadpool.ThreadPool(10)
# reqs=threadpool.makeRequests... | {
"repo_name": "YuHongJun/python-training",
"path": "work_one/requestUrlTest.py",
"copies": "1",
"size": "1373",
"license": "mit",
"hash": -5040773757337042000,
"line_mean": 28.1111111111,
"line_max": 86,
"alpha_frac": 0.6600458365,
"autogenerated": false,
"ratio": 2.5972222222222223,
"config_te... |
class Node(object):
"""链表结构的Node节点"""
def __init__(self, data, next_node=None):
"""Node节点的初始化方法.
参数:
data:存储的数据
next:下一个Node节点的引用地址
"""
self.__data = data
self.__next = next_node
@property
def data(self):
"""Node节点存储数据的获取.
... | {
"repo_name": "wangzheng0822/algo",
"path": "python/06_linkedlist/singlyLinkedList.py",
"copies": "1",
"size": "9190",
"license": "apache-2.0",
"hash": 1583086988806336500,
"line_mean": 24.0211267606,
"line_max": 87,
"alpha_frac": 0.4976076555,
"autogenerated": false,
"ratio": 2.2261904761904763,... |
# 1.定义一个方法 func,该func可以引入任意多的整型参数,结果返回其中最大与最小的值。
# def func(*num):
# result = list(num)
# return sorted(result)[0], sorted(result)[len(result) - 1]
# 2.定义一个方法func,该func可以引入任意多的字符串参数,结果返回(长度)最长的字符串。
# def func(*string):
# result_list = []
# result_list = [(x, len(x)) for x in list(string)]
# retur... | {
"repo_name": "bluedai180/PythonExercise",
"path": "Exercise/Method.py",
"copies": "1",
"size": "2635",
"license": "apache-2.0",
"hash": -2026009484972654800,
"line_mean": 26.0579710145,
"line_max": 84,
"alpha_frac": 0.6497054097,
"autogenerated": false,
"ratio": 1.7287037037037036,
"config_tes... |
#1. 打印功能提示
print("="*50)
print(" 名片管理系统 V0.01")
print(" 1. 添加一个新的名片")
print(" 2. 删除一个名片")
print(" 3. 修改一个名片")
print(" 4. 查询一个名片")
print(" 5. 显示所有的名片")
print(" 6. 退出系统")
print("="*50)
#用来存储名片
card_infors = []
while True:
#2. 获取用户的输入
num = int(input("请输入操作序号:"))
#3. 根据用户的数据执行相应的功能
if num==1:
... | {
"repo_name": "nacker/pythonProject",
"path": "01Base/03/04-名片关系系统.py",
"copies": "2",
"size": "1857",
"license": "apache-2.0",
"hash": -142679517496484860,
"line_mean": 20.8382352941,
"line_max": 96,
"alpha_frac": 0.4962962963,
"autogenerated": false,
"ratio": 2.1742313323572473,
"config_test"... |
# 1. 给你一本书(input),统计里面词频最高的10个单词
# 先是说考虑input是一个大string的情况,用hashmap+maxheap直接秒就行了,注意一些细节处理就好,我写完被挑出一些小毛病,改完小哥很满意然后上follow up: input是一个文件?改下代码的input处理就好了,按行读入按单词存入hashmap。写完继续follow up:如果input文件很大,hashmap爆了内存怎么办?只考虑ASCII。然后开始估算大概要用多少内存,算下来几M到几十M不等的内存占用,然后pass
import collections
import heapq
def word_frequency(input, n)... | {
"repo_name": "seanxwzhang/LeetCode",
"path": "Facebook/PE/word_frequency.py",
"copies": "1",
"size": "1279",
"license": "mit",
"hash": 2421095081970710000,
"line_mean": 32.4482758621,
"line_max": 225,
"alpha_frac": 0.657378741,
"autogenerated": false,
"ratio": 1.9695121951219512,
"config_test"... |
#1에서 10000까지의 자연수의 각 자릿수에 3,9가 있으면 짝을, 6이 있으면 뽁짝을, 2,4,8은 뽁을 출력한다.
#단, 순서를 지킨다.
count=0 #문자를 쓸지 숫자를 쓸지 판단하기 위함
dictionary = {} #각 숫자의 모든 자리를 검사해서 자리번호가 key, 표시할 대상이 value인 순서쌍을 저장한다.
while True:
max = int(input("숫자를 입력하세요 : "))
if max <1 or max >10000: #말은 이렇게 했지만 이것만 지우면 모든 자연수를 다 할 수 있다. 나도 내가 두렵다. 나란 녀석.... | {
"repo_name": "imn00133/pythonSeminar17",
"path": "exercise/369/Sehun/10_14_369_final_ppokjjak.py",
"copies": "1",
"size": "3485",
"license": "mit",
"hash": -2349220524865442300,
"line_mean": 47.7857142857,
"line_max": 104,
"alpha_frac": 0.4254851703,
"autogenerated": false,
"ratio": 1.8378196500... |
1#!/usr/bin/env python2.7
"""MongoDB hub for insertion of data into our servers.
This module inserts into GVA2015_data collection documents with the following
structure::
{
"_id": ObjectID(...),
"house": HOUSE_NAME,
"basetime": DATE VALUE IN TIMESTAMP,
"topic": MQTT TOPIC WITH '/' ... | {
"repo_name": "ESAI-CEU-UCH/raspi-monitoring-system",
"path": "raspi_mon_sys/MongoDBHub.py",
"copies": "1",
"size": "7589",
"license": "mit",
"hash": 35571248033360536,
"line_mean": 35.6618357488,
"line_max": 118,
"alpha_frac": 0.6334167875,
"autogenerated": false,
"ratio": 3.6485576923076923,
... |
1 # !/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import os
import numpy as np
import dlib
import sklearn.decomposition
import pickle
import mappings
import copy
# Emotion tags in ascending order
emotions = ['neutral', 'anger', 'contempt', 'disgust',
'fear', 'happiness', 'sadness', 'surprise']
... | {
"repo_name": "mkeyran/EmotionRecognizer",
"path": "preprocess.py",
"copies": "1",
"size": "8941",
"license": "mit",
"hash": 6960509125343195000,
"line_mean": 37.3620689655,
"line_max": 119,
"alpha_frac": 0.5579775281,
"autogenerated": false,
"ratio": 3.877995642701525,
"config_test": true,
"... |
# 1/usr/bin/env python3
# Sending data over a stream but delimited as length-prefixed blocks
import socket
import struct
header_struct = struct.Struct('!I') # message upto 2 ^ 32 -1 in length
def recvall(sock, length):
blocks = []
while length:
block = sock.recv(length)
if not block:
... | {
"repo_name": "gauravssnl/python3-network-programming",
"path": "blocks.py",
"copies": "1",
"size": "2331",
"license": "mit",
"hash": 3773237586894841300,
"line_mean": 30.5,
"line_max": 77,
"alpha_frac": 0.6469326469,
"autogenerated": false,
"ratio": 3.6708661417322834,
"config_test": false,
... |
# 1/usr/bin/env python3
# UDP client and server for broadcast messages on a local LAN
import socket
BUFFSIZE = 65535
def server(interface, port):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((interface, port))
print("listening for datagrams at {}".format(sock.getsockname()))
whi... | {
"repo_name": "gauravssnl/python3-network-programming",
"path": "udp_broadcast.py",
"copies": "1",
"size": "1309",
"license": "mit",
"hash": -8288777238236095000,
"line_mean": 34.3783783784,
"line_max": 87,
"alpha_frac": 0.6653934301,
"autogenerated": false,
"ratio": 3.7082152974504248,
"config... |
#1/usr/bin/env python
from mechanize import Browser
from BeautifulSoup import BeautifulSoup
outfile = open("artscraper.txt", "w")
mech = Browser()
url = "http://www.jerseyarts.com/OnlineGuide.aspx?searchType=advanced&searchTerm=D%3ad7%3bR%3ar1%2cr2%2cr3%2cr4%3bSp%3a0%3bGc%3a0%3bF%3a0"
page = mech.open(url)
html = pa... | {
"repo_name": "tommeagher/Scrapers",
"path": "artscraper/artscrape.py",
"copies": "1",
"size": "3591",
"license": "mit",
"hash": -4064488765503823000,
"line_mean": 56.9193548387,
"line_max": 266,
"alpha_frac": 0.5360623782,
"autogenerated": false,
"ratio": 3.5838323353293413,
"config_test": fal... |
#1/usr/bin/env python
#mechanize acts as an browser to collect html response
from mechanize import Browser
#beautifulsoup lets you strip out the html and parse it through its tree
from BeautifulSoup import BeautifulSoup
#csvkit allows you to output to a csv file easily
from csvkit.unicsv import UnicodeCSVWriter
#re han... | {
"repo_name": "tommeagher/Scrapers",
"path": "townsites/townscrape.py",
"copies": "1",
"size": "1545",
"license": "mit",
"hash": -951006210631249200,
"line_mean": 31.8936170213,
"line_max": 98,
"alpha_frac": 0.7113268608,
"autogenerated": false,
"ratio": 3.5354691075514872,
"config_test": false... |
#1/usr/bin/env python
import sys
import re
CHROM=0
POS=1
INFO=7
GT=9
def main():
if len(sys.argv) == 1:
vcf_file = sys.stdin
else:
vcf_file = open(sys.argv[1])
file_out = sys.stdout
file_out.write("Chrom\tPos\tAF\tMQ\tGT\tEffect\tImpact\tGene_name\n")
for line in vcf_file:
if line.lstrip()[0] != "#":
... | {
"repo_name": "maubarsom/biotico-tools",
"path": "TcIV-scripts/VCFPhaseEff2table.py",
"copies": "1",
"size": "1529",
"license": "apache-2.0",
"hash": 4579206966587522600,
"line_mean": 22.1666666667,
"line_max": 70,
"alpha_frac": 0.6461739699,
"autogenerated": false,
"ratio": 2.4661290322580647,
... |
1#!/usr/bin/env python
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
version = '0.9.6'
setup(name='mi-instrument',
version=version,
description='OOINet Marine Integrations',
url='https://github.com/oceanobservatories/mi-instrument',
... | {
"repo_name": "oceanobservatories/mi-instrument",
"path": "setup.py",
"copies": "1",
"size": "1215",
"license": "bsd-2-clause",
"hash": 983015008068370800,
"line_mean": 31.8378378378,
"line_max": 87,
"alpha_frac": 0.6024691358,
"autogenerated": false,
"ratio": 3.5319767441860463,
"config_test":... |
#1/usr/bin/env python
# rss locker
filetypes_you_want = ".jpg .png .tiff .gif .jpeg .webp".split(" ")
def get_file_text(file_path):
# returns all text from a file.
# Warning this may block up scripts for long files.
with open(file_path,"r") as f:
return(str(f.read()))
def script_path(include_nam... | {
"repo_name": "CodyKochmann/rss_vault",
"path": "run.py",
"copies": "1",
"size": "4096",
"license": "mit",
"hash": -8954793643966664000,
"line_mean": 30.5076923077,
"line_max": 109,
"alpha_frac": 0.5695800781,
"autogenerated": false,
"ratio": 3.710144927536232,
"config_test": false,
"has_no_k... |
# 1. WAP to create and merge two list and then sort it wihtout function sort
# 2. WAP to create list of number and sort even numbers using LIST COMPREHENSION
# 3. WAP to calculate number of uppercase and lowercase from input string.
l1=[]
l2=[]
a=int(input("Enter number of elements you want to enter in list 1: "... | {
"repo_name": "Akagi201/learning-python",
"path": "list/practice3.py",
"copies": "1",
"size": "1261",
"license": "mit",
"hash": -8111531305823587000,
"line_mean": 20.1228070175,
"line_max": 80,
"alpha_frac": 0.5812846947,
"autogenerated": false,
"ratio": 2.967058823529412,
"config_test": false,... |
# 1) What is a recursive function?
# A function calls itself, meaning it will repeat itself when a certain line or a code is called.
# 2) What happens if there is no base case defined in a recursive function?
#It will recurse infinitely and maybe you will get an error that says your maximum recursion is reached.
# 3)... | {
"repo_name": "beth2005-cmis/beth2005-cmis-cs2",
"path": "cs2quiz3.py",
"copies": "1",
"size": "1645",
"license": "cc0-1.0",
"hash": -6662969976070371000,
"line_mean": 30.6346153846,
"line_max": 134,
"alpha_frac": 0.6899696049,
"autogenerated": false,
"ratio": 3.323232323232323,
"config_test": ... |
from micropython import const
import _onewire as _ow
class OneWireError(Exception):
pass
class OneWire:
SEARCH_ROM = const(0xf0)
MATCH_ROM = const(0x55)
SKIP_ROM = const(0xcc)
def __init__(self, pin):
self.pin = pin
self.pin.init(pin.OPEN_DRAIN, pin.PULL_UP)
def reset(self, ... | {
"repo_name": "micropython/micropython-esp32",
"path": "drivers/onewire/onewire.py",
"copies": "22",
"size": "2432",
"license": "mit",
"hash": 9067405670282738000,
"line_mean": 25.7252747253,
"line_max": 82,
"alpha_frac": 0.4921875,
"autogenerated": false,
"ratio": 3.7300613496932513,
"config_t... |
from micropython import const
import _onewire as _ow
class OneWireError(Exception):
pass
class OneWire:
SEARCH_ROM = const(0xF0)
MATCH_ROM = const(0x55)
SKIP_ROM = const(0xCC)
def __init__(self, pin):
self.pin = pin
self.pin.init(pin.OPEN_DRAIN, pin.PULL_UP)
def reset(self... | {
"repo_name": "pfalcon/micropython",
"path": "drivers/onewire/onewire.py",
"copies": "1",
"size": "2436",
"license": "mit",
"hash": -9059079040850688000,
"line_mean": 25.1935483871,
"line_max": 82,
"alpha_frac": 0.4913793103,
"autogenerated": false,
"ratio": 3.719083969465649,
"config_test": fa... |
import _onewire as _ow
class OneWireError(Exception):
pass
class OneWire:
SEARCH_ROM = 0xF0
MATCH_ROM = 0x55
SKIP_ROM = 0xCC
def __init__(self, pin):
self.pin = pin
self.pin.init(pin.OPEN_DRAIN, pin.PULL_UP)
def reset(self, required=False):
reset = _ow.reset(self.p... | {
"repo_name": "stinos/micropython",
"path": "drivers/onewire/onewire.py",
"copies": "14",
"size": "2395",
"license": "mit",
"hash": -7932161086781865000,
"line_mean": 25.0326086957,
"line_max": 82,
"alpha_frac": 0.4860125261,
"autogenerated": false,
"ratio": 3.718944099378882,
"config_test": fa... |
from micropython import const
import _onewire as _ow
class OneWireError(Exception):
pass
class OneWire:
SEARCH_ROM = const(0xf0)
MATCH_ROM = const(0x55)
SKIP_ROM = const(0xcc)
def __init__(self, pin):
self.pin = pin
self.pin.init(pin.OPEN_DRAIN)
def reset(self, required=Fals... | {
"repo_name": "Xykon/pycom-micropython-sigfox",
"path": "esp8266/modules/onewire.py",
"copies": "12",
"size": "2430",
"license": "mit",
"hash": -887834777208866700,
"line_mean": 25.7032967033,
"line_max": 82,
"alpha_frac": 0.4925925926,
"autogenerated": false,
"ratio": 3.7442218798151004,
"conf... |
import _onewire as _ow
class OneWireError(Exception):
pass
class OneWire:
SEARCH_ROM = const(0xf0)
MATCH_ROM = const(0x55)
SKIP_ROM = const(0xcc)
def __init__(self, pin):
self.pin = pin
self.pin.init(pin.OPEN_DRAIN)
def reset(self):
return _ow.reset(self.pin)
de... | {
"repo_name": "misterdanb/micropython",
"path": "esp8266/scripts/onewire.py",
"copies": "8",
"size": "3338",
"license": "mit",
"hash": 1354741967146086000,
"line_mean": 25.2834645669,
"line_max": 82,
"alpha_frac": 0.5068903535,
"autogenerated": false,
"ratio": 3.521097046413502,
"config_test": ... |
# 1. Write a function called common_end() that takes two lists.
# It will return True if the two lists either have the same
# first element, the same LAST element, or both.
# common_end([1,2,3], [7,3]) ---> True
# common_end([1,2,3], [7,3,2]) ---> False
# common_end([1,2,3], [1,7]) ---> True
def common_... | {
"repo_name": "Nethermaker/school-projects",
"path": "intro/list_and_for_loop_assignment.py",
"copies": "1",
"size": "3707",
"license": "mit",
"hash": -3739872054988869600,
"line_mean": 21.16875,
"line_max": 96,
"alpha_frac": 0.5600215808,
"autogenerated": false,
"ratio": 3.0211898940505297,
"c... |
# A flexible object to redirect standard output and standard error
# Allows logging to a file and to set a level of verbosity
# Copyright Michael Foord, 2004.
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# For information about bugfixes, updates and support, ple... | {
"repo_name": "cligu/gitdox",
"path": "modules/standout.py",
"copies": "2",
"size": "19719",
"license": "apache-2.0",
"hash": 8628892551416264000,
"line_mean": 40.8662420382,
"line_max": 186,
"alpha_frac": 0.6725493179,
"autogenerated": false,
"ratio": 3.9828317511613816,
"config_test": true,
... |
# A simple proxy server that fetches pages from the google cache.
# Homepage : http://www.voidspace.org.uk/python/index.html
# Copyright Michael Foord, 2004 & 2005.
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/documents/BSD-LICENSE.txt
# For information about bugfixes, updates and ... | {
"repo_name": "ActiveState/code",
"path": "recipes/Python/408991_GoogleCacheServer/recipe-408991.py",
"copies": "1",
"size": "4874",
"license": "mit",
"hash": 8650231299246874000,
"line_mean": 35.9242424242,
"line_max": 175,
"alpha_frac": 0.6844480919,
"autogenerated": false,
"ratio": 3.726299694... |
"""20.07.2015 PyOSE: Stacked exomoons with the Orbital Sampling Effect."""
import PyOSE
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib import rc
from numpy import pi
# Set stellar parameters
StellarRadius = 0.7 * 696342. # km
limb1 = 0.5971
limb2 = 0.1172
# Set planet parameters
PlanetR... | {
"repo_name": "hippke/PyOSE",
"path": "CreateFigure8a.py",
"copies": "1",
"size": "2836",
"license": "mit",
"hash": 7197681053772878000,
"line_mean": 36.8133333333,
"line_max": 80,
"alpha_frac": 0.7175599436,
"autogenerated": false,
"ratio": 2.7507274490785645,
"config_test": false,
"has_no_k... |
"""20.07.2015 PyOSE: Stacked exomoons with the Orbital Sampling Effect."""
import PyOSE
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib import rc
#import xlwt
#from tempfile import TemporaryFile
from numpy import pi
# Set stellar parameters
StellarRadius = 0.7 * 696342. # km
limb1 = 0.597... | {
"repo_name": "hippke/PyOSE",
"path": "CreateFigure11.py",
"copies": "1",
"size": "3248",
"license": "mit",
"hash": 4166175099531349500,
"line_mean": 32.8333333333,
"line_max": 80,
"alpha_frac": 0.7090517241,
"autogenerated": false,
"ratio": 2.708924103419516,
"config_test": false,
"has_no_ke... |
"""20.07.2015 PyOSE: Stacked exomoons with the Orbital Sampling Effect."""
# Stacked exomoons with the Orbital Sampling Effect (OSE, Heller 2014, ApJ 787)
#
# _.--"~~ __"-. Copyright 2015 Michael Hippke and contributors
# ,-" .-~ ~"-\ OSE-Sampler is free software
# .^ / ... | {
"repo_name": "hippke/PyOSE",
"path": "PyOSE.py",
"copies": "1",
"size": "15868",
"license": "mit",
"hash": 9089201926173079000,
"line_mean": 43.0777777778,
"line_max": 88,
"alpha_frac": 0.6458280817,
"autogenerated": false,
"ratio": 3.355466271939099,
"config_test": false,
"has_no_keywords":... |
# 200 = a * 100 + b * 50 + c * 20 + d * 10 + e * 5 + f * 2 + g
def count(money, level):
if level == 1:
return 1
elif level == 2:
possible = money // 2
sum = 0
for i in range(0, possible + 1):
sum += count(money - i * 2, 1)
return sum
elif level == 5:
... | {
"repo_name": "xnap/projecteuler",
"path": "31.py",
"copies": "1",
"size": "1366",
"license": "mit",
"hash": 4382195763776500700,
"line_mean": 26.32,
"line_max": 62,
"alpha_frac": 0.4494875549,
"autogenerated": false,
"ratio": 3.672043010752688,
"config_test": false,
"has_no_keywords": false,... |
"""200. Number of Islands
https://leetcode.com/problems/number-of-islands/
Given a 2d grid map of '1's (land) and '0's (water), count the number of
islands. An island is surrounded by water and is formed by connecting adjacent
lands horizontally or vertically. You may assume all four edges of the grid
are all surround... | {
"repo_name": "isudox/leetcode-solution",
"path": "python-algorithm/leetcode/number_of_islands.py",
"copies": "1",
"size": "1193",
"license": "mit",
"hash": -444083736101085600,
"line_mean": 19.9298245614,
"line_max": 78,
"alpha_frac": 0.5398155909,
"autogenerated": false,
"ratio": 3.379603399433... |
# 200. Number of Islands
#
# Given a 2d grid map of '1's (land) and '0's (water), count the number of islands.
# An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.
# You may assume all four edges of the grid are all surrounded by water.
#
# Example 1:
#
# 11110
# 110... | {
"repo_name": "gengwg/leetcode",
"path": "200_number_of_islands.py",
"copies": "1",
"size": "3569",
"license": "apache-2.0",
"hash": -1805888363420235500,
"line_mean": 26.6744186047,
"line_max": 105,
"alpha_frac": 0.4704398991,
"autogenerated": false,
"ratio": 3.1923076923076925,
"config_test":... |
# 2010-07-17 - 2011-01-16 @ david barkhuizen
# yahoo finance harvester component
import http.client
http.client.HTTPConnection.debuglevel = 0
import urllib
URL_STEM = 'http://ichart.finance.yahoo.com/table.csv?'
def construct_ichart_csv_url(symbol, fromY, fromM, fromD, toY, toM, toD):
'''
('BP', '1900', '01', '0... | {
"repo_name": "davidbarkhuizen/yfh",
"path": "v1/httpadaptor.py",
"copies": "1",
"size": "1238",
"license": "mit",
"hash": -7837285653623167000,
"line_mean": 21.9259259259,
"line_max": 110,
"alpha_frac": 0.6025848142,
"autogenerated": false,
"ratio": 2.41796875,
"config_test": false,
"has_no_... |
""" 2012.06.15
1. This script joins separate Skia .gyp files (core,opts,effects,ports,utils...)
into one "gyp/skia_dll_msvs2010e.gyp", that could be used to create one shared lib (dll).
see "skia_dll_config" below for more details.
2. Creates "gyp/win32_app.gyp" and "skia_win32.gyp" ... | {
"repo_name": "vosvos/skia-win32-dll",
"path": "skia_dll_msvs2010e.py",
"copies": "1",
"size": "11233",
"license": "bsd-3-clause",
"hash": 3872887527055753000,
"line_mean": 32.2469512195,
"line_max": 197,
"alpha_frac": 0.5312027063,
"autogenerated": false,
"ratio": 3.728177895784932,
"config_te... |
# 2012-2-12 Fix bug where quality was not taking precedence over order
# See http://code.google.com/p/mimeparse/issues/detail?id=10
# 2012-2-12 Fix bug where a quality value of 0 was being overwritten with 1
# See http://code.google.com/p/mimeparse/issues/detail?id=15
"""MIME-Type Parser
This module provides basic fu... | {
"repo_name": "bruth/restlib2",
"path": "restlib2/mimeparse.py",
"copies": "1",
"size": "5992",
"license": "bsd-2-clause",
"hash": 6903788586532053000,
"line_mean": 42.1079136691,
"line_max": 116,
"alpha_frac": 0.6320093458,
"autogenerated": false,
"ratio": 3.6693202694427436,
"config_test": fa... |
#2013.06.06 V2
#C:\\Python27\python C:\\Users\Bing\Videos\read2.py
#cd C:\\Users\Bing\Videos
import os
#Set directory
old_dir = os.getcwd()
#os.chdir('/home/bing/Documents')
os.chdir('C:\\Users\Bing\Videos')
#Read data from input file and place in table
f = open('test.txt', 'r')
f.readline() #reads and ignores the fi... | {
"repo_name": "kotoroshinoto/Cluster_SimpleJob_Generator",
"path": "pybin/MutectAnalysis/Drafts/methodslistDraft2.py",
"copies": "1",
"size": "1581",
"license": "unlicense",
"hash": 8929349348155658000,
"line_mean": 22.6119402985,
"line_max": 76,
"alpha_frac": 0.6654016445,
"autogenerated": false,
... |
# 2013.08.22 22:25:33 Pacific Daylight Time
# Embedded file name: toontown.suit.Suit
from direct.actor import Actor
from otp.avatar import Avatar
import SuitDNA
from toontown.toonbase import ToontownGlobals
from pandac.PandaModules import *
from toontown.battle import SuitBattleGlobals
from direct.task.Task import Task... | {
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"path": "toontown/suit/Suit.py",
"copies": "1",
"size": "38666",
"license": "mit",
"hash": 797889818532806900,
"line_mean": 37.0570866142,
"line_max": 119,
"alpha_frac": 0.571277091,
"autogenerated": false,
"ratio": 3.270128552097429,
"conf... |
# 2013.09.29 18:39:30 W. Europe Daylight Time
# Embedded file name: scripts/client/messenger/gui/Scaleform/channels/bw_battle_controllers.py
import BattleReplay
from LanguageFilterControll import testIfEnglish
from debug_utils import LOG_DEBUG, LOG_ERROR
from gui.BattleContext import g_battleContext
from gui.shared i... | {
"repo_name": "sgoldenb/siemafilter",
"path": "src/bw_battle_controllers.py",
"copies": "1",
"size": "9917",
"license": "mit",
"hash": -443908975520755600,
"line_mean": 38.3531746032,
"line_max": 146,
"alpha_frac": 0.6641121307,
"autogenerated": false,
"ratio": 3.8542557326078506,
"config_test"... |
# 2013-2014 Massachusetts Open Cloud Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | {
"repo_name": "SahilTikale/switchHaaS",
"path": "haas/api.py",
"copies": "1",
"size": "32172",
"license": "apache-2.0",
"hash": 4981292955450466000,
"line_mean": 30.821958457,
"line_max": 101,
"alpha_frac": 0.6364229765,
"autogenerated": false,
"ratio": 3.7698617295523786,
"config_test": false,... |
# 2013 Nikola Peric
import sys
import re
import traceback
from io import FileIO as file
from PyPDF2 import PdfFileWriter, PdfFileReader, PdfFileMerger
from PySide.QtGui import QMainWindow, QPushButton, QApplication, QLabel, QAction, QWidget, QListWidget, QLineEdit, QFileSystemModel, QTreeView, QListView, QGroupBox, QGr... | {
"repo_name": "nikolap/pdfmerger",
"path": "legacy_python/pdfMerger.py",
"copies": "1",
"size": "6357",
"license": "mit",
"hash": -4594071519562648600,
"line_mean": 33.7431693989,
"line_max": 277,
"alpha_frac": 0.7221960044,
"autogenerated": false,
"ratio": 3.0042533081285443,
"config_test": fa... |
# 2013 Problem 4
# Ghostbusters and Ghosts Gun Grappple
n, r = [int(i) for i in input().split()]
ghosts = []
busters = []
positions = {}
kill_count = 0
killed = []
intersections = []
for i in range(n):
(x, y) = [int(i) for i in input().split()]
ghosts.append((x,y))
for i in range(n):
(x, y) = [int(i) for ... | {
"repo_name": "AdamOSullivan46/ACM",
"path": "2013/P4.py",
"copies": "1",
"size": "1905",
"license": "mit",
"hash": 7665759832787779000,
"line_mean": 30.2295081967,
"line_max": 179,
"alpha_frac": 0.4818897638,
"autogenerated": false,
"ratio": 2.56393001345895,
"config_test": false,
"has_no_ke... |
# 2013-Q-A : Tic-Tac-Toe-Tomek
def check_row(row):
if "." not in row:
s = list(set(row))
if len(s) == 1:
return "{} won".format(s[0])
elif ("T" in s) and (len(s) == 2):
for c in s:
if c != "T":
return "{} won".format(s[0])
re... | {
"repo_name": "subhrm/google-code-jam-solutions",
"path": "solutions/2013/Q/A/A.py",
"copies": "1",
"size": "1485",
"license": "mit",
"hash": 3157699393625783300,
"line_mean": 21.5,
"line_max": 54,
"alpha_frac": 0.4094276094,
"autogenerated": false,
"ratio": 2.975951903807615,
"config_test": fa... |
# 2013-Q-C : Pre-compute things
from itertools import product
pali = lambda x: x == x[::-1]
def test(n):
for i in range(n + 1):
sqr = str(i * i)
si = str(i)
if pali(sqr) and pali(si):
print("{:7} , {:14}".format(si, sqr))
def gen_pallindrome(max_len):
pali_list = [1, 4, ... | {
"repo_name": "subhrm/google-code-jam-solutions",
"path": "solutions/2013/Q/C/pre_compute.py",
"copies": "1",
"size": "1828",
"license": "mit",
"hash": 1989859525100314400,
"line_mean": 25.4927536232,
"line_max": 58,
"alpha_frac": 0.3840262582,
"autogenerated": false,
"ratio": 3.108843537414966,
... |
# 2013 syl20bnr <sylvain.benner@gmail.com>
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law. You can redistribute it and/or modify it under
# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
# 2, as published by Sam Hocevar. See h... | {
"repo_name": "syl20bnr/i3ci",
"path": "_deprecated/scripts/py3status/feeders/kb_leds.py",
"copies": "1",
"size": "2344",
"license": "mit",
"hash": 4009926147755918300,
"line_mean": 32.9710144928,
"line_max": 79,
"alpha_frac": 0.5656996587,
"autogenerated": false,
"ratio": 3.264623955431755,
"c... |
# 20140106
# Jan Mojzis
# Public domain.
import nacl.raw as nacl
from util import fromhex, flip_bit
def verify_16_test():
"""
"""
for x in range(0, 10):
x = nacl.randombytes(nacl.crypto_verify_16_BYTES)
y = x
nacl.crypto_verify... | {
"repo_name": "warner/python-tweetnacl",
"path": "test/test_verify_16.py",
"copies": "1",
"size": "1052",
"license": "mit",
"hash": -58365631113542130,
"line_mean": 20.4693877551,
"line_max": 66,
"alpha_frac": 0.4657794677,
"autogenerated": false,
"ratio": 3.8254545454545457,
"config_test": fal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.