blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
dbf8500ae9262ccb5472edfd85b010fb38115b8f | aa6638f3f4ad64efe8b28a49fb981cbf8de73a95 | Naam/lpbm | /lpbm/modules/render.py | Python | py | 13,633 | permissive | # lpbm/modules/articles.py - Loads articles and treats them.
# Author: Franck Michea < franck.michea@gmail.com >
# License: New BSD License (See LICENSE)
import codecs
import datetime
import math
import os
import shutil
import sys
import tempfile
import PyRSS2Gen
import jinja2
import markdown
import lpbm.module_load... |
cd209e08bc4efde7da380227698b620c984b375c | 643277b539c18deef5e13cd8844fd32f347159d9 | srinjoym/tableleg_pose | /src/get_tableleg_pose.py | Python | py | 884 | no_license | #!/usr/bin/env python
from tableleg_pose.srv import *
import geometry_msgs.msg
from arm_moveit import *
import rospy
class GetTableLegPose:
def __init__(self):
self.arm = ArmMoveIt()
def handle_get_tableleg_pose(self,req):
# print "Returning [%s + %s = %s]"%(req.a, req.b, (req.a + req.b)... |
6c2b770c6c6a3d068253bb10e110c9435fffd718 | 962309fb25ed06fba81910c9845c75e355fa4318 | Sayo-nika/Backend | /framework/error_handlers/error_common.py | Python | py | 977 | permissive | # Stdlib
import json
# External Libraries
from quart import Response, request
# Moved out of response_wrappers.py due to circular imports
def error_handler(func):
"""Wrapper for error handlers that returns a similar format as `route_wrappers.json`."""
async def inner(*args, **kwargs):
response = awa... |
0903e7dbd215d4900c625fd18e031eba994e2b8b | 7eb6cb0e56e34404cea36f5d539d3e924b05147b | smartniz/elastic-wikidata | /elastic_wikidata/config.py | Python | py | 538 | permissive | class RuntimeConfig:
def __init__(self):
self.items = {}
def add_item(self, item: dict):
"""
Add an item to the runtime config
"""
self.items.update(item)
def get(self, key: str):
"""
Get specific item from config. Returns None if key doesn't exist.... |
01f18d75e4b4618260e3b1e85eda720290e68bd8 | 3ae6cfcbcc257cd2d3664309642d78dd78c754d4 | janetcharwood/pgc3-scz_wg-genesets | /ANNOTATION_AUTO/scripts/human_gene2go_extract_hbp.py | Python | py | 10,650 | no_license | #!/usr/bin/python
# this script extracts human data from the NCBI gene2go file.
# headers for NCBI 'gene_info' file
# tax_id GeneID Symbol LocusTag Synonyms dbXrefs chromosome map_location
# description type_of_gene Symbol_from_nomenclature_authority Full_name_from_nomenclature_authority
# Nomenclature_status Other_... |
af8358f48efd3a2016b5fb4e261020f88c192767 | bdfc859e53aa0f2bca58f35fc94616e5c5f41ac7 | teamikl/JamTabaResource | /messages/apply_template.py | Python | py | 1,703 | no_license | #!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
"""
Generate HTML Pre-View
Usage:
$ python ../gen_properties.py \
--sheet-id=1rtIBZNy-An7dujla4_HmX6yEv6PxcBiJexA3Ex7ZGZo \
--sheet-gid=1078035474 > messages_ja.properties
$ python ./apply_template.py > vs-site-ja-preview.html
For windows:
... |
67b8cc3eca48ec70e53dc82f2fe02d0ebdf78e50 | 3051bb321daef8c31882031c1cb5786ea04d19ee | ragehegy/invaders | /player.py | Python | py | 6,526 | no_license | import pygame
from pygame.locals import *
import os
import widget
def load_images(dir, colorkey=None):
arr = []
try:
images = os.listdir(dir)
except(pygame.error, message):
print('Cannot load images dir:' + dir)
for i in images:
image = pygame.image.load(dir+i)
# image =... |
420de49815ec2d870de132934f62b01f23f57828 | 9536a263b711a645391e57cabc97046b9398322f | zmzhydron/python | /class.py | Python | py | 972 | no_license | #-*- encoding: utf8 -*-
#4.15 python类型尝试
class Person(object):
def __init__(self,name,power="fuck"):
self.__name = name
self.__power = power
def sayname(self):
# print("my name is %s my sex is %s, my age is %s"%(self.name,self.sex,self.age))
print("my name is %s"%self.__name)
def getName(self):
... |
62c1cdb998d5d29e8f197f3d2a8573bb6440c775 | 561f64a35ad42ec326a52bb3b1f6334583356d00 | chromium/chromium | /third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/echo-cookie-worker.py | Python | py | 700 | permissive | def main(request, response):
headers = [(b"Content-Type", b"text/javascript")]
values = []
for key in request.cookies:
for cookie in request.cookies.get_list(key):
values.append(b'"%s": "%s"' % (key, cookie.value))
# Update the counter to change the script body for every request to... |
0b7b2b7a83067d6e32ec54a69368056ca84478e5 | 4d32d11a78618259f11d3cbf05f32752aaa15657 | AjBreidenbach/mouse_agreements | /mouse_agreements.py | Python | py | 309 | no_license | from flask import Flask
from flask import request, Response
from document import Document
import json
app = Flask(__name__)
import sys
@app.route('/convert', methods=['POST'])
def convert():
print(request.data, file=sys.stderr)
return Response(status=200, response=(Document(request.data).output))
|
d17f2f8fac240e7511d1eb2aa23f778735cd4954 | 5cfa9686ce2f60f370ed3d14ad08189d60357831 | BlackTrace/lighthouse | /plugin/lighthouse/metadata.py | Python | py | 37,718 | permissive | import time
import Queue
import bisect
import ctypes
import logging
import threading
import idaapi
import idautils
from lighthouse.util import *
logger = logging.getLogger("Lighthouse.Metadata")
#------------------------------------------------------------------------------
# Metadata
#-----------------------------... |
ab6e5e7ae1d75c1a9b496ba962057f7272705be2 | 02e10cd70c71c62b72ba23b574dcd52178cb0584 | nneiros/python-learning | /python33/exercise_python/frouta_malia_stoixeia.py | Python | py | 3,482 | no_license | the_count = [1, 2, 3, 4, 5]
fruits = ['μηλα', 'πορτοκαλια', 'ροδακινα', 'αχλαδια']
change = [1, 'ευρω', 2, 'λεπτα', 3, 'τεταρτα']
# Αυτή η πρώτη του είδους for-loop περνά μέσα από μια λίστα
print('Λιστα αριθμων',the_count)
print('Μετραω:')
for number in the_count:
print ("%d" % number)
# Ίδια όπως παραπ... |
0ed02e7913ebeb23aa9db8b5089a8365bf71d1e1 | 806cc403df7ee196340b373a1595159728c94077 | sjas/opsmop | /opsmop/providers/package/package.py | Python | py | 1,154 | permissive | # Copyright 2018 Michael DeHaan LLC, <michael@michaeldehaan.net>
#
# 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 app... |
de4566d49617c529899821d9cb7768191f5a221c | 042ace8874848fb899b99c5bdb88124fb8b71d5a | z-van-baars/SpaceJaunt | /spacejaunt.py | Python | py | 6,880 | no_license | import pygame
import utilities
import assets
import player
import levels
import enemy
from spritesheet import Spritesheet
pygame.display.set_caption("Time for a jaunt")
class Crosshair(pygame.sprite.Sprite):
def __init__(self):
super().__init__()
self.state = 2
sprite_sheet = Spriteshee... |
59cb1d7a47dd33703ba20f1d52771f4d321b299a | 7188ab1201910cf2a1567d746b1f0e54e9c8107e | kevinniel/monopoly | /classes/chance.py | Python | py | 444 | no_license | class Chance:
def __init__(self, id, params):
self.id = id
self.text = params["text"]
self.win_money = params["win_money"]
self.loose_money = params["loose_money"]
self.move_to = params["move_to"]
self.pay_per_house = params["pay_per_house"]
self.pay_per_hote... |
be44856094729ee115a13ae9bce6cb199fde0b3c | 9a4b4bad4efc364be3ce43bc29d0b36789d77faf | tefra/xsdata-samples | /travelport/models/availability_error_info.py | Python | py | 654 | no_license | from __future__ import annotations
from dataclasses import dataclass, field
from travelport.models.air_segment_error import AirSegmentError
from travelport.models.type_error_info_1 import TypeErrorInfo1
__NAMESPACE__ = "http://www.travelport.com/schema/air_v52_0"
@dataclass
class AvailabilityErrorInfo(TypeErrorInfo1... |
3ed0c17311f8c239f3fc6f28fb05620e24ff8a78 | d09afc8c883eed21898acbe5bb917022d48c6e7b | Hori1234/otmdservices | /tests/api/test_reports.py | Python | py | 3,699 | permissive | import datetime
from io import BytesIO
from pathlib import Path
import pytest
import json
from openpyxl import load_workbook
from pandas.core.common import not_none
from backend.models import TruckSheet, OrderSheet
def get_file_path(file):
return Path(__file__).parent / 'data' / file
@pytest.fix... |
ed42a51706d3929789d4f9a54e09b113d4eaad42 | 15deb71c6362bc1efe41b85446b22442dbb0a0b4 | mlihc15/Cirq | /cirq/ops/common_gates_test.py | Python | py | 25,499 | permissive | # Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
03aa05a5b727a9030074252ea5f1679a9fe0834c | 0a5a6268700114116b50ea5f20dfc45eb12fda1b | prerakl123/Management-Systems | /Restaurant_Management_System/Receipt_SQL_Connector.py | Python | py | 5,992 | no_license | import pymysql
def print_data():
pass
def AddtoDrinks(command):
"""Add Drinks Data to table : drinks_info.
:param command (received through dicts and lists corresponding to drinks details in '__main__' file)"""
connection = pymysql.Connect(host='localhost', user='root', passwd='', database... |
954350102952694e86f946526e0cf31b34091e56 | b7e5ea958c449e61db89542cb634a7783b1f1876 | kurtzeborn/azure-sdk-for-python | /sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_security_connector_governance_rule_operations.py | Python | py | 6,833 | permissive | # pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRe... |
9fe6d7a791162d1de99a35656b8f59b6996979ea | d7fa99165c1aa4a9e9f9d579947777308410143d | Laravel-Guru/Blog | /blog/migrations/0001_initial.py | Python | py | 1,225 | no_license | # Generated by Django 3.0.8 on 2020-08-02 05:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
7ca1c34ebe6099f10bca7e589e165238daf7cf8a | 6cdedd815770a67ebd5482d5e707f905515f9128 | Code-Institute-Submissions/kalopsia_lens | /kalopsia_lens/urls.py | Python | py | 1,266 | no_license | """kalopsia_lens URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class... |
03289037caa5f8378cc004aca378cc0da1b70f3b | 5de40eed6f013ca3b73d1af645e0c517f3a9ec93 | RyanKung/pulsar | /pulsar/apps/data/redis/store.py | Python | py | 4,728 | permissive | from functools import partial
from pulsar import Connection, Pool, get_actor
from pulsar.utils.pep import to_string
from pulsar.apps.data import RemoteStore
from pulsar.apps.ds import redis_parser
from .client import RedisClient, Pipeline, Consumer, ResponseError
from .pubsub import RedisPubSub, RedisChannels
class... |
07e53bae70cb972f4d5165a0265d26d5d3af0d11 | 29fc9600146533fc2a93d7817d9171a7f8083ec1 | haomingchan0811/Fake-News-Challenge | /classification3.py | Python | py | 1,622 | no_license | import pickle
import math
import sys
from index import *
from feature import *
from collections import Counter
if __name__ == '__main__':
filename = sys.argv[1]
f = open(filename, 'r')
s = Index.load('index')
feature = Feature()
lines = f.readlines()
threshold = [20, 0.001, 0.1]
features = [0,0,0]
numFeature... |
3b32b5c24bdd157619c4101375ea5b70a7e449f7 | 5a081041e3f513e05441a5eedf5368cf0fbc9d31 | luck1006/auto-api | /views/productOrder/Order_params/Zizhu_Order_params_zizhutrain.py | Python | py | 11,827 | no_license | # -*- coding:UTF-8 -*-
# @Author : huangfang
from views.productOrder.BOH_params.Zizhu_BOH_train import Zizhu_BOH_train
from app.actions.tools.commonData import productdata_zizhu
import datetime
class Zizhu_Order_params_zizhutrain(Zizhu_BOH_train):
#获取行程1ID
def zizhu_get_journeyId1(self):
jo... |
7bc06ffe0356a4e96b3a287dc44326ff29c4004f | 398fb105cc49f531dcda291efbed356e9022f3b7 | USEPA/SWMM-EPANET_User_Interface | /test/core/swmm/test_lid_usage_with_base.py | Python | py | 1,308 | no_license | import unittest
from test.core.swmm.test_base import BastForTests
from core.swmm.inp_reader_sections import LIDUsageReader
from core.swmm.inp_writer_sections import LIDUsageWriter
class SimpleLIDUsageTest(BastForTests):
"""Test LIDUSAGE section"""
def __init__(self):
BastForTests.__init__(self)
d... |
4a0ff351b68f5ec243ef0bcdbd07145cbbb9df82 | 2615faa1b081e1248c45b126a38033e8974e9927 | Nicehax101/django-twitter | /blog/migrations/0028_auto_20201127_1958.py | Python | py | 674 | no_license | # Generated by Django 3.0.8 on 2020-11-27 16:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0027_auto_20201127_1956'),
]
operations = [
migrations.AlterField(
model_name='comment'... |
4a6de29db0f4c21c7ee31a7b280cb4e02ceff206 | 62a6298ed8ca3e8dda6997fca58361cf05356fda | dasaint001/Usedcarpricepredictor | /app.py | Python | py | 1,119 | no_license | # Dependencies
from flask import Flask, request, jsonify
import joblib
import traceback
import pandas as pd
import numpy as np
regr = joblib.load("model.pkl") # Load "model.pkl"
model_columns = joblib.load("model_columns.pkl") # Load "model_columns.pkl"
# Your API definition
app = Flask(__name__)
@app.... |
dc81986734bf343e320083af3f8d5cc399886960 | 45708d1292a589108926a21f550f3fcf1aadb229 | ewhuang/pacer | /pca_top_pathways.py | Python | py | 5,850 | no_license | ### Author: Edward Huang
from collections import OrderedDict
from sklearn.decomposition import PCA
from scipy.stats.stats import spearmanr
import numpy as np
### This script uses PCA to find the most important genes. For each pathway p,
### we will have a G*N gene expression matrix A. N is the number of patients, G
#... |
2e2bc27f8efaee2ff62847f965ddace3f415749c | 18014695b92475d0936b1d017266c594f2c50952 | yangchuan123/artificial-intelligence-for-trading_yangchuan | /quiz/m2_advanced_quants/l3_regression/visualize.py | Python | py | 1,672 | no_license | """Visualize the distribution of different samples."""
import pandas as pd
import matplotlib.pyplot as plt
def plot_histogram(sample, title, bins=3, **kwargs):
"""Plot the histogram of a given sample of random values.
Parameters
----------
sample : pandas.Series
raw values to build histogram... |
2ea3fe65794cf8ab9af64d5f77604cffa00692a1 | be21a0c7502e87098b84f2033ef000fe7d832065 | thefirstofthe300/python-harvest_apiv2 | /tests/estimates.py | Python | py | 25,573 | permissive |
# Copyright 2020 Bradbase
#
# 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 agreed to in writing, so... |
bc1e7059bb6bb60ce18ba2428a2b00585e551ea2 | 48dabb846fc592985a670429403f9f61a58197b8 | xuechao1/PytestProject | /testing/conftest.py | Python | py | 653 | no_license | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
___author___ = 'Steven Emerson'
___date___ = '2020/7/12 13:18'
import pytest
# scope='session' 每个项目只执行一次,整个python执行一次
# scope='module' 每个模块也就是每个.py文件,只执行一次
# @pytest.fixture(scope='session') # 实现在 单个方法里面执行 setup_class
# @pytest.fixture(autouse=True, params=['user... |
32057a5dd04f2e8885a1ddce1945673c51a9652b | b358a9dd0f65c3a5d611e9a57933fbed48999f67 | JKChang2015/Python | /Work/ontology/onto_test.py | Python | py | 301 | no_license | # onto_test
# Created by JKChang
# 2019-02-25, 20:49
# Tag:
# Description:
from owlready2 import IRIS
from owlready2 import get_ontology
onto = get_ontology('../resources/Metabolights.owl').load()
# c = list(onto.classes())
c = onto.search_one(label = 'Investigator')
d = c.isDefinedBy[0]
print() |
f96a908958f8d012342ee41554ea0a3c6986d20e | 562f188341e0199f29383c7891a71f70e4c2d857 | justcalamari/tick-my-feedstocks | /setup.py | Python | py | 1,271 | permissive | #!/usr/bin/env python
from setuptools import setup, find_packages
def main():
with open('README.md', 'r') as f:
long_description = f.read()
with open('requirements.txt', 'r') as f:
requirements = [line for line in f]
setup(
name='tick-feedstocks',
version='0.0.0',
... |
a29c095f8ced7437af21d72de6d8feeb182df11a | 63596d7132c40a7c26d4d8adb71916d23622bd91 | askdjango/django-fieldmaker | /fieldmaker/spec_widget.py | Python | py | 14,193 | permissive | from django import forms
from django.conf import settings
from django.forms import widgets
from django.forms.formsets import formset_factory, BaseFormSet
from django.forms.utils import flatatt
from django.utils.safestring import mark_safe
from .resource import field_registry, registry
def compare_dict(data1, data2):
... |
db94b9719be02fc886c20374849ec4e33775b690 | cd756a0d203055e0768f6067123cccb50faf0535 | sushmita-swain/Dashboard_Python_Plotly_Dash | /20-Milestone_Project/StockTicker4.py | Python | py | 2,069 | no_license | #######
# First Milestone Project: Develop a Stock Ticker
# dashboard that either allows the user to enter
# a ticker symbol into an input box, or to select
# item(s) from a dropdown list, and uses pandas_datareader
# to look up and display stock data on a graph.
######
# ADD A DATEPICKERRANGE COMPONENT FOR START & EN... |
aace852d5707f4310dd25f44fc8b558669fdf536 | 71c62929917a7bbe49949feaae0a1a5798cc554c | LVK-96/WSD-project | /wsd_project/users/migrations/0001_initial.py | Python | py | 2,996 | no_license | # Generated by Django 2.1.4 on 2019-02-20 09:08
from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '... |
787935db46661bcbbc6f62a6ee9ca48db6c7c19b | 1ebf4e1b0285c9d97d7d5073d5e4e63e4ededc1d | dwkula/data-structures | /general-trees.py | Python | py | 1,236 | no_license | class TreeNode:
def __init__(self, data) -> None:
self.data = data
self.children = []
self.parent = None
def add_child(self, child):
child.parent = self
self.children.append(child)
def get_level(self):
level = 0
p = self.parent
while p:
... |
24c29aba61435a5f8912c249ad963641f1bebed6 | 19747da4df72079f50c7e1f7bcdd82ff079d381a | Bunajirou/Cryptography | /decryption_gui.py | Python | py | 2,399 | no_license | import math
import sympy
import tkinter
A = 32 # ASCIIコードのA番以降を使う(delも除外) A=32で制御文字を除くすべてのASCII文字が使用可能
max_prime = pow(10, 201)
min_prime = pow(10, 200)
p = sympy.randprime(min_prime, max_prime)
q = sympy.randprime(min_prime, max_prime)
while(p == q):
q = sympy.randprime(min_prime, max_prime)
n = p * q
L = ma... |
d813c6e07f4c99b4bc78b830d80f321bb3b7448f | 732a27aad4e56b9b69190624642609774b1c673b | mburaksayici/Practical-CNN-Udemy | /kerasdatagen.py | Python | py | 1,673 | no_license | from keras.applications.inception_v3 import InceptionV3
from keras.preprocessing import image
from keras.models import Model
from keras.optimizers import Adam
from keras.layers import Dense, GlobalAveragePooling2D,Dropout
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
base_mo... |
04fc420e614ee3858229ea5053b1548b0ccbd559 | a8c5ea332c2ffe801b16308795f4d88a89a94667 | goosemo/blog | /_filters/paragraph_permalinks.py | Python | py | 535 | no_license | #Give every paragraph an id if it doesn't have one.
#This allows you to reference individual paragraphs by permalink:
# http://yourblog.com/blog/this-is-a-post#p5
from pyquery import PyQuery as pq
def run(content):
#pyquery needs this wrapped in some tag, otherwise it loses the top-most tag
#when .html() is r... |
641a6afb2507ccfddb9a26babc074d33441342d7 | f754342e53d042f29565002677efa83be3216b9f | Lieberator/Old_Projects | /Part1/UserPassExtended_function.py | Python | py | 1,123 | no_license |
#checks the password
def Get_Password(verified_users, username):
for u, p in verified_users.items():
if u == username:
password = p['password']
return password
else:
password = 'wrong password'
return password
verified_users = {
'jlieb' : {
'password' : 'Tootsie2',
},
'scott18' : {
'passwo... |
5542cc910e00f9e65efc9320fe6e2f9c85d014a0 | e2896b1cf120163f222fa89720520cc1f2c6d505 | ilyashustermansf/receipt_tagger_test | /source/database/db_sql_alchemy.py | Python | py | 1,928 | no_license | #!/usr/bin/env python
import logging
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from database.dbsettings import DATABASES
class DbSqlAlchemy(object):
def __init__(self):
self.engine = None
self.connection = None
self.cursor = None
self._session = None
self.... |
d93759626ab0d9eaea6bd87b0138d6b0eb59da41 | 19259606fb0e46348cef44a2d8a44dd6e944cd15 | Ilivanilton/estudo-oo-py | /modulo1/basico.py | Python | py | 2,677 | no_license | #basico
print("------------#numeros-----------------")
print(10 / 2)
print(10 // 2)
print(10 * 2)
print(10 ** 3)
print(10 % 3)
#string
print("------------#string-----------------")
x = "x:\numer"
print(x)
print("c:\numer")
print("c:\numer")
print(r"c:\numer")
print( (r"c:\numer") *2 )
name = "ilivanlton"
print(name[2]... |
9ce1729a73143b34167194eae17543a7193cfa01 | 27a34a77e92646a6febc1efcb61aed91e80e08ef | evanqianyue/Python | /day20/copy_file/启动进程实现多任务 - 副本.py | Python | py | 1,071 | no_license | # !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
@ Author :Evan
@ Date :2018/11/6 16:18
@ Version : 1.0
@ Description:
@ Modified By:
"""
"""
multiprocessing 库
跨平台版本的多进程模块,提供一个process类来代表一个进程对象
"""
from multiprocessing import Process
import time
import os
def run1(str1, str2):
while True:
... |
9c08e03f0309418c5b04ce8f0d650560e49ee98c | 30f725763423bbccbfe73204bb1e50e7a632d054 | imhpdev/django_web | /webSite/settings.py | Python | py | 3,089 | no_license | """
Django settings for webSite project.
Generated by 'django-admin startproject' using Django 2.0.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
# B... |
60e7a6934f6b51614a0f1eca224508720afce593 | acd2a76ecd09fb4ad23f8911198a7c44a21ae37c | Kennexcorp/Algorithms-DataStructure | /others/Battery.py | Python | py | 561 | no_license | class Battery(object):
def __init__(self, battery_size = 75):
self.battery_size = battery_size
def describe_battery(self):
"""Print a statement describing the battery size"""
print(f"This car has a {self.battery_size} - kWh battery.")
def get_range(self):
"""Print a stateme... |
b3ac14810dda2739cb8b840b7db88ca4d3b8ef08 | cae220fb2439a3e291ba5e46d24c226534f63deb | krahman/BuildingMachineLearningSystemsWithPython | /ch07/usermodel.py | Python | py | 1,788 | permissive | # This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import numpy as np
from scipy import sparse
from sklearn.linear_model import LassoCV, RidgeCV, ElasticN... |
8bc7604dee0841011a9d07d34a51e3883e8ceaa6 | 0b449956cc8eee734170ff8fcd97e879831904e2 | revotechUET/wi-uservice | /services/random_forest_regression/src/model_helper.py | Python | py | 1,950 | no_license | import os
import functools
import connexion
from sklearn import metrics
from sklearn.model_selection import train_test_split
from src import ml_models
from src import config
def parse_body_request(func):
@functools.wraps(func)
def modified_func(*args, **kwargs):
request_body = connexion.request.json
... |
997c45529a554e162b048df0336f8e2739f08f22 | de27e77d2e20446d923605d7e764ca612eca190d | MinionsOliverLi/small | /PycharmProjects/PerfectCRM/fashion_admin/fashion_admin.py | Python | py | 1,039 | no_license | from crm import models
enable_admins = {}
class Baseadmin(object):
list_display = []
list_filter = []
list_editable = []
search_fields = []
filter_horizontal = []
list_per_page = 1
class CustomerAdmin(Baseadmin):
list_display = ['id', 'qq', 'source', 'status', 'date']
list_filter =... |
bac4761bbcb06ebcac4a28aa250a93083a6f5bf1 | cab84f4fe7383d4067e6de38cd99b9d42c669202 | spiaz/advent_of_code_2018 | /Day 03/day03.py | Python | py | 1,474 | no_license | #%%
from typing import List, Tuple, Iterator
from collections import Counter
import re
with open("input.txt", "r") as infile:
lines = [re.sub(r"[#@,:x]", r" ", l.strip()) for l in infile]
def parselines(lines: List[str]) -> Tuple[List[int], List[Tuple[int, int, int, int]]]:
ids = [int(l.split()[0]) for l in l... |
a56264117b32b5af532707490ebefa470ae3b9d3 | a981ea8dd70d251aecc9e0cc303a33e9d9804414 | text007/python | /A1/ex11.py | Python | py | 268 | no_license | # 用户输入
# input():用户输入
print("How old are you?", end=" ")
age = input()
print("How tall are you?", end=" ")
height = input()
print("How much do you weigh?", end=" ")
weight = input()
print(f"So, you're {age} old, {height} tall and {weight} heavy.")
|
da268e986d373150d377e8449012802811058408 | 710d2705431272568cd56e60340193251450bb40 | AnushaBalusu/PythonCodes | /Lab7/variable_node.py | Python | py | 2,153 | no_license | """
CSCI-603 Parser Lab
Author: Sean Strout @ RIT CS
Author: {YOUR NAMES HERE}
A variable expression is a legal identifier in Python:
'{id}'
For example:
'x'
'y'
'variable'
When emitted, the variable name is returned as a string, e.g.:
'x'
'y'
'variable'
When evaluated, the value asso... |
8dd0127e9ad3cdeeb69e6bfd37ed48124a752d9d | fb68ec8d82b6d64380b14dd286adc118752dd530 | thirtywang/OpenPNM | /test/unit/Geometry/models/PoreMiscTest.py | Python | py | 3,495 | permissive | import OpenPNM
import scipy as sp
import OpenPNM.Geometry.models as gm
class PoreMiscTest:
def test_constant(self):
pass
def setup_class(self):
self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5])
self.geo = OpenPNM.Geometry.GenericGeometry(network=self.net,
... |
d396ec43491c01e6e609c8abc121f6dd79a07b0a | fe4e16d8d7f4a934295f24dc5734a7221f236b4a | phorsfall/ml | /ex/dbn/generate_samples.py | Python | py | 2,890 | permissive | import os.path
import functools
import itertools
import collections
import operator
import tempfile
import numpy as np
from ml import mnist, utils, optimize, rbm, dbn, data, parameters
from ml.sigmoid import logistic
np.random.seed(32)
DATA_PATH = os.path.expanduser('~/Development/ml/datasets')
OUTPUT_PATH = os.pat... |
1044c789dfdbb5800e81a5aa4b20194be72a2082 | 4b3f6d5805d8dd8a194837d26f6ad43ed4ca53c2 | kingel/morepath | /morepath/error.py | Python | py | 543 | no_license | # -*- coding: utf-8 -*-
class ConfigError(Exception):
"""Raised when configuration is bad
"""
class ResolveError(Exception):
"""Raised when path cannot be resolved
"""
class ModelError(ResolveError):
"""Raised when a model cannot be resolved
"""
class ViewError(ResolveError):
"""Rais... |
86dbdd904e6aae7058228773caa7e2af418f8512 | c002aa20a9acae38c9994d2ceff0980619a494cb | Kukkerem/lightnovel-crawler | /sources/en/m/mangarockteam.py | Python | py | 243 | permissive | # -*- coding: utf-8 -*-
import logging
from lncrawl.templates.madara import MadaraTemplate
logger = logging.getLogger(__name__)
class MangaRockTeamCrawler(MadaraTemplate):
has_manga = True
base_url = ["https://mangarockteam.com/"]
|
2af981a05129674e63be8c42a0e4809088be0c30 | 98feab114cff6ea5a541b1fdfd1b73348b3f6f90 | liupenggl/hybrid | /rsel.py | Python | py | 4,465 | no_license |
import networkx as nx
import matplotlib.pyplot as plt
def readFile(g,path="graph.txt"):
f=open(path,'r')
for eachLine in f:
if eachLine.find('*Edges')==-1:
continue
else:
break
for eachLine in f:
if len(eachLine)<2:
continue
li=eac... |
d8bca1fb5b7c6b47364cb076a879b5070e21ecc9 | e324a02b7b031cfdfde6fb8e820910573750227e | guerler/galaxy | /test/integration/test_datatype_upload.py | Python | py | 5,128 | permissive | import collections
import os
import shutil
import pytest
from galaxy.datatypes.registry import Registry
from galaxy.util.checkers import (
is_bz2,
is_gzip,
is_zip,
)
from galaxy.util.hash_util import md5_hash_file
from galaxy_test.driver import integration_util
from .test_upload_configuration_options impo... |
fc3e5d6886c73432e7ded6dc5771def5273f7a50 | 43c110021a245b6edf15f0e9528c31c31d333f55 | joshuamchavez2/Telco-Classification-Project | /prepare.py | Python | py | 3,995 | no_license | from math import sqrt
from scipy import stats
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from pydataset import data
import statistics
import acquire
from sklearn.model_selection import train_test_split
from sklearn.impute import SimpleImputer
from sklearn.impute import ... |
437ff753815912a5c58983d0302d002b3e99ccd4 | edb0056d31cbd6d6eb6a40cf7dae708df40a869c | brightsparklabs/appcli | /setup.py | Python | py | 2,421 | permissive | #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
"""
Python Package File
________________________________________________________________________________
Created by brightSPARK Labs
www.brightsparklabs.com
"""
import re
# to use a consistent encoding
from codecs import open
from os import path
from subprocess impor... |
05da49385f989e2595721d8c478ab3e44be871f7 | e3e29bae0f10662b1a81cf07b650215f224f7b2e | maddanki-cyber/macyber | /604_hw4.py | Python | py | 3,890 | no_license | import scipy.io
import numpy as np
from sklearn import svm as hi
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import LinearSVC
mat = scipy.io.loadmat('/Users/mahesh1/Downloads/usps_all_final.mat')
#print(type(mat))
#print(mat)
data = mat['dat... |
e654ce36ec12424fc934e89ea0816dfc20b0b249 | 0ed0d67c10f5386b1e510cba9bd0c279ae72ac4b | ceremcem/nodeenv | /nodeenv.py | Python | py | 44,078 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
nodeenv
~~~~~~~
Node.js virtual environment
:copyright: (c) 2014 by Eugene Kalinin
:license: BSD, see LICENSE for more details.
"""
import contextlib
import io
import json
import sys
import os
import re
import ssl
import stat
import logging
import... |
000a065c2546c0fbc94fc179f2e73de42779eddf | d789fa99bca90359666d021fe468441d34acc8a7 | ccooper21/nap-apr-2019 | /2-toggle/toggle.py | Python | py | 824 | permissive | from machine import Pin
from utime import sleep
# ONE-TIME SETUP
# Pin 12 corresponds to the pin labeled "D6" on the NodeMCU development board.
# By setting the "PULL_UP" flag, the pin will be held at 3.3V when the button
# is not pressed. When the button is pressed the pin will be connected to
# ground, and hence h... |
b67e42c9928fbdbebb9c4febe10c05148d7910df | ab5a07491f96f30900446731d4913a6fe3efc89f | schwancr/schwancr_bin | /scripts/get_state_avg.py | Python | py | 2,498 | no_license | #!/usr/bin/env python
import numpy as np
from argparse import ArgumentParser
from pyschwancr import averages
from mdtraj import io
import os
def run(ass_fn_list, data_fn_list, out_fn):
print ass_fn_list, data_fn_list, out_fn
assert len(ass_fn_list) == len(data_fn_list)
if os.path.exists(out_fn):
... |
12044e190748ab909db9c000c6c972858642d304 | a9ee6aeb5d0cb13af50e343f7d233d6f9c597064 | neeleshsinha/skincancerdetection | /folds.py | Python | py | 457 | no_license | import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
from sklearn import model_selection
# create folds
df = pd.read_csv("train.csv")
df["kfold"] = -1
df = df.sample(frac=1).reset_index(drop=True)
y = df.target.values
kf = model_selection.StratifiedKFo... |
f74766f7aca4d1093192b3938c49692226424714 | b5864ab6fec69373ed90e90d65bd22611dcc32cb | pedrocardenas247/medicosback | /medicos/asgi.py | Python | py | 391 | no_license | """
ASGI config for medicos project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTI... |
85eb2e76ee5c6aad42150810aa4ebbe2b874034d | de761cd9c05152b8c3058c80b1def824eb3abdf3 | Tanc009/jdcloud-sdk-python | /jdcloud_sdk/services/lb/models/UpdateLoadBalancerSpec.py | Python | py | 1,544 | permissive | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 agreed ... |
c0da7e0c2106168e89cf22e5a81c65c72d0f3f9b | 03596abb279f7f58e339a75a16cc8fe041c0f9c6 | Katee0727/pythonstudy | /ex3.py | Python | py | 835 | no_license | # The purpose of the following activity
print "I will now count my chickens:"
# Counting Hens and Roosters
print "Hens", 25.0 + 30.0 / 6.0
print "Roosters", 100.0 - 25.0 * 3.0 % 4.0
# Display the next activity
print "Now I will count the eggs:"
# Do math to count eggs
print 3.0 + 2.0 + 1.0 - 5.0 + 4.0 % 2.0 - 1.0 / ... |
788022f7ef8686f56ce67e6211989ec1bacb6216 | 22e4223cfb18ad3c8b72ea3e2f51b7c10bdb71fa | jostosh/libspn-1 | /libspn/inference/mpe_path.py | Python | py | 5,498 | permissive | from types import MappingProxyType
import tensorflow as tf
from libspn.inference.value import Value, LogValue
from libspn.graph.algorithms import compute_graph_up_down
from libspn.graph.basesum import BaseSum
from libspn import utils
class MPEPath:
"""Assembles TF operations computing the branch counts for the MP... |
503d10b724c150c7d2b9eb64174c73edc8a94f64 | 84cb17c2911979ec45d56e8ad12c094ff2ce12a9 | JohnDoee/autotorrent | /autotorrent/tests/test_bencode.py | Python | py | 351 | permissive | import os
from io import open
from unittest import TestCase
from ..bencode import bdecode, bencode
class TestBEncode(TestCase):
def test_reencode(self):
with open(os.path.join(os.path.dirname(__file__), 'testfiles', 'test.torrent'), 'rb') as f:
data = f.read()
self.assertEqua... |
ed3e85fb108294742d0038d654437e4e9f341b9b | 6aeef18ce4259dde924af5e02dca74e5d2f16537 | redcliver/CosaNostra1 | /CosaNostra/CosaNostra/cortes/migrations/0008_auto_20170704_1559.py | Python | py | 470 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-04 19:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cortes', '0007_auto_20170704_1558'),
]
operations = [
migrations.AlterField... |
7e0c28e747442312adff6a1dc2e3851bc24219c5 | 0085cd560792de927f0f17a48b93a7e346e1c1b5 | demianbrecht/python-sitehooks-example | /manage.py | Python | py | 804 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testme.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
e1d96395319c346f8d0dce3d7fb6b4263dbaafe8 | 5db8091b8e07de921525e4ab49512ba62ee965b0 | akawoa/python | /flask_mysql/Recipes/recipes_app/controllers/recipes.py | Python | py | 4,135 | no_license | from recipes_app import app
from flask import render_template, redirect, request, session
from flask_bcrypt import Bcrypt
from recipes_app.models.user import User
from recipes_app.models.recipe import Recipe
bcrypt = Bcrypt(app)
@app.route('/recipes/new')
def add_recipe():
if 'user_id' not in session:
ret... |
7ebfc60bc96156dad6d32d5c1ec5a75e7ff10a87 | 8007e11b62b2bca46bdaecda05ef37a085ea379c | jonmagnus/INF1900 | /APPA/cos_Taylor_series_diffeq.py | Python | py | 312 | no_license | import matplotlib.pyplot as plt
import numpy as np
def cos_Taylor(x,n):
s = 0; a = 1
for j in range(1,n+1):
s += a
a *= -x*x/float((2*j - 1)*2*j)
return s, np.abs(a)
x = np.linspace(0,6*np.pi,101)
y = [cos_Taylor(x_,20)[0] for x_ in x]
plt.plot(x,y)
plt.plot(x,np.cos(x))
plt.ylim(-1.4,1.4)
plt.show()
|
0f4bbcee65b46b320302c594fac62568fc0f6e07 | 626454e35dff0ca5fd3f5b69333b6f5e5e27b375 | mondaine-esdl/klimaatmonitor-esdl | /stringuri.py | Python | py | 604 | no_license | from io import BytesIO
from pyecore.resources import URI
class StringURI(URI):
def __init__(self, uri, text=None):
super(StringURI, self).__init__(uri)
if text is not None:
self.__stream = BytesIO(text.encode('UTF-8'))
def getvalue(self):
readbytes = self.__stream.getvalue... |
a02a94e092cb651408f7f3f6998ff9109ed9208e | b12c93c9ae992aed27db3a4be236449480f9b6b3 | kanzabatool3002/hangman | /hangman.py | Python | py | 4,537 | no_license | #In this program we create hangman game.
keepgoing="y" #If the user inputs 'y' the loop repeats
# If the condition true, the loop starts executing
while (keepgoing == "y"):
import random #Shuffle a list
def hangman():
names=["pakistan","thailand","china","singapore","afghanistan","america","malaysia",... |
26e30293a229ebfa05228b291f62c0628b0b1eb5 | ffcfabba4ceb01a8f4db6910d0790bacb9ed742a | wsgan001/PyFPattern | /Data Set/bug-fixing-5/8c456d8e38256dbf7fc7b48eeb444815a17f2a75-<main>-fix.py | Python | py | 6,163 | no_license | def main():
argument_spec = ec2_argument_spec()
argument_spec.update(dict(state=dict(required=True, choices=['present', 'absent', 'deleting']), name=dict(required=True, type='str'), cluster=dict(required=False, type='str'), task_definition=dict(required=False, type='str'), load_balancers=dict(required=False, de... |
bf81e217baeb6fc2fafd7aee8554483e308f98d4 | 508de89622f853f63a9c95c3ce0e976f7a6c080e | m-hahn/memory-surprisal | /code/create_models/yCreateRandomModels_Basque_OnlyWordForms_BoundedVocab.py | Python | py | 1,103 | no_license | # /u/scr/mhahn/deps/memory-need-neural-wordforms/search-Basque_yWithMorphologySequentialStreamDropoutDev_BaselineLanguage_Fast_SaveLast_NoFinePOS_OnlyWordForms_BoundedVocab.py_model_530125850_RANDOM_BY_TYPE.txt
import subprocess
import random
from math import exp
import sys
model = sys.argv[1]
if len(sys.argv) > 2:... |
fafa19bdbe8c8382fe53a77ffb70a858200d16f3 | 140e74612274a77fcd1b7ca9fbb8851165ff114c | Mike-Huang01/HackOS-Assembler | /Assembler.py | Python | py | 5,180 | no_license | import sys
import os
import string
#ParseASM is used to seperate the comand
class ParseASM(object):
def __init__(self,line):
self.lineL=line.strip()
def dealLine(self):
if self.lineL:
ins=self.lineL.split()[0]
if ins.startswith('@'):
ains=ins[... |
3626bf8795546f3be0d306bcdb7cba18bb1765ad | 31affd448a04463e51a461917ad60cb3e7e5543d | DELPiSHO/Programming-in-Python | /Python for beginners/task15.py | Python | py | 223 | no_license | a = int(input())
b = int(input())
c = int(input())
if b <= a:
if c <= b:
print("2 <= 1")
print("3 <= 2")
else:
print("2 <= 1")
elif c <= b:
print("3 <= 2")
else:
print("all is good") |
635bbaf159059a1da352afa38806fb1fc3fdbcb2 | 5b83ddf854f91567d9bb18f2daa63f7705a1f133 | CMS-TMTT/cmssw | /RecoLocalCalo/EcalRecProducers/test/compare_csv.py | Python | py | 1,266 | permissive | from __future__ import print_function
import sys
import exceptions
def compare(fn1, fn2):
f1, f2 = open(fn1, "r"), open(fn2, "r")
diff_cols = {}
for l1, l2 in zip(f1.readlines(), f2.readlines()):
if l1 == l2: continue
for i, (k1, k2) in enumerate(zip(l1.strip().split(), l2.strip().split()... |
369ef3c56c1303d74e2b96a38f6b9fd8e3b60117 | 52449909e02b7c5860a3828cd250a75e3cd0089e | luoyjx/fun | /err.py | Python | py | 371 | no_license | import sys
import traceback
try:
someFunction()
except:
ex = sys.exc_info()[1]
print(ex.__class__.__name__)
#print '\n'.join(traceback.format_exc().split('\n')[:-2])
#print traceback.format_stack()[0]
#template = "An exception of type {0} occurred. Arguments:\n{1!r}"
#message = template.for... |
7214d815ea4a31110a51983f61ae5de44e694b65 | 89468451a19d7c84a5ed9a262516e93146825ad2 | wsgan001/PyFPattern | /Data Set/bug-fixing-1/9ac6a01d84de1573e0ab42b107154fb31105c035-<to_writeable>-fix.py | Python | py | 1,543 | no_license |
def to_writeable(source):
' Convert input object ``source`` to something we can write\n\n Parameters\n ----------\n source : object\n\n Returns\n -------\n arr : None or ndarray or EmptyStructMarker\n If `source` cannot be converted to something we can write to a matfile,\n return ... |
e79ef0d92c87dd00a61d4a9f1f088bf6b8a0dcb8 | 661a63defe9590be3f00dfaba7c420547a8c5905 | BALAVIGNESHDOSTRIX/PYTHON-OOPS_PROGRAMS | /Multiple_Inheritence.py | Python | py | 1,538 | permissive |
'''
The class derived from more than 1 base called as a Multiple Inheritence.
Programmer_name : BALAVIGNESH.M
Implemented_Date : 11-11-2018
'''
class OS:
SecurityOS = "Linux"
DeveloperlikeOS = "Mac OS"
Most_Personal_usage_OS = "Windows"
class KernerlType:
SecurityOS_Kernel = "MonoLit... |
e392449aa564ea2ac1e80464181663b8579a010e | 0791af437f1f349d16a0679adb1a9a0c3eba8e4a | andrewsmedina/horizon | /horizon/horizon/dashboards/nova/access_and_security/floating_ips/urls.py | Python | py | 1,123 | permissive | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... |
33da97de0f1cc95e52f8882847665fefee1a8d54 | 41e72cecc3329ee0a9142e7278ba965b67989cbc | muskanmahajan37/alexa-apis-for-python | /ask-smapi-model/ask_smapi_model/v2/skill/simulations/simulation_result.py | Python | py | 4,483 | permissive | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... |
48221904300738a8fc3a3c0207ac9ec7d35f8ab8 | 9d8f64a2cc6958a22af5dc26bd7aedebc173dceb | FilipTrocin/Switch-python_console_game | /players.py | Python | py | 1,499 | no_license | import random
import user_interface as UI
class Player:
is_ai = False
def __init__(self, name):
self.name = name
self.hand = []
def select_card(self, choices, _):
return UI.select_card(choices)
def ask_for_swap(self, others):
return UI.select_player(others)
class S... |
9073581a253e0f9f3afbe7e2119efad81745c3c5 | b2b3f1619b18681bde46a98396987280a384a24c | david-mackay/SPISE | /students p1.py | Python | py | 809 | no_license | """Python has square root built in but you can write your own.
Here's a common technique for finding the sqaure root of some
number x........
1. Begin with initial guess 1.
2. Update your guess to be .5 * ((guess**2) + x / guess) .
3. Repeat step 2 as needed.
4. Return the value of guess as the square root
W... |
2e934acd87c9e6c6350f4d272bc36b684840cc88 | f3bbbc16ee0add045d5c37d6bf721b5c8ff48830 | git-hash/pyspider | /pyspider/database/mongodb/mongodbbase.py | Python | py | 1,450 | permissive | #!/usr/bin/env python
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2014-11-22 20:42:01
import time
class SplitTableMixin(object):
UPDATE_PROJECTS_TIME = 10 * 60
def _collection_name(self, project):
if self.collection_prefix:
... |
038630ee838dd995a0d24462205504f894db2f19 | f8cd309903bdb9ea882d5a4cf2346eed9765ff0e | Normal-case/pyary | /memory_storage/urls.py | Python | py | 1,111 | no_license | """memory_storage URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Clas... |
1100650fcfad3f33659381e6f9d9f33506557168 | 1c5e291d766bc7d7ca84f7433994c52ac099cd71 | 330mlcc/mp | /src/fundamental/db/useUnitTesting.py | Python | py | 389 | permissive | __author__ = 'Administrator'
class Dict(dict):
def __init__(self,**kw):
super().__init__(**kw)
def __getattr__(self, key):
try:
return self[key]
except KeyError:
raise AttributeError("r 'Dict' object has not attrbute '%s'" % key)
... |
689b6a75c3fdcbf0f566da932dea980b124b339d | efbd964cc912d5818c5a28d4bc819f9c01d057f8 | standardgalactic/reconner | /docs/src/tutorial/3_dataset_stats.py | Python | py | 307 | permissive | from pathlib import Path
import typer
from recon.dataset import Dataset
from recon.stats import get_ner_stats
def main(data_file: Path):
data = read_jsonl(data_file)
train_stats = get_ner_stats(data)
print(get_ner_stats(data, serialize=True))
if __name__ == "__main__":
typer.run(main)
|
17bbdfb8c14c2aadbf2798e20b01690c6dbc558c | 6038039acde37886f1e2f5f9ce13d73cf552075c | liwzhi/Zillow-house-prediction | /Desktop/machineLearning-master/removeDuplicates.py | Python | py | 788 | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 5 12:24:24 2015
@author: weizhi
"""
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListN... |
09ffee3f8169f42258262861a85a505d86549912 | 73e9a370a4b4ed078c19dd3ce31d2734daf70500 | njabswalsh/Dominion | /Floobits/bigMoney.py | Python | py | 1,894 | no_license | import cardUtils, DominionPlayer
#An implementation of the Big Money strategy
class BigMoney(DominionPlayer.DominionPlayer):
def __init__(self, mdp, usingCachedWeights=False, cachingWeights=False, cacheStringKey=""):
self.handSize = mdp.handSize
self.maxTurns = mdp.maxTurns
self.bigVPCard... |
1d33b02dffb234ba3c172b6145d00b8d2e71e9bf | 50d4d485fe972e88325e8f878dc698f67e3309d5 | ldsad7/actum_hack | /manage.py | Python | py | 630 | permissive | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'actum_hack.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Imp... |
fede9ee7cc599a61ec66009f11dd5c745395254e | 6b04c3926f1700ddab1c40ee3f3cdcb3d3c2311f | hiredd/ECGAnalysisProject | /AF/simple_medical_analysers/detection_combiner.py | Python | py | 1,108 | no_license |
import numpy as np
class DetectionCombiner():
def __init__(self):
pass
def verify(self, channelX=[], sampling_ratio=250, tol_compare_time=0.05):
newChannelX = []
tol_samples = tol_compare_time * sampling_ratio
old_element = -1 - tol_samples
for element in channelX:... |
d7ad2d0d8d624a17d0c51fc57454f84734a1641f | 4ef872b31f8a3dcdc4fc9cd5734888f0f107b62a | zaidkilani/royalsp | /places.py | Python | py | 1,258 | no_license | # -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.osv import expression
class PlaceOfDelivery(models.Model):
_name = 'delivery.place'
_rec_name = 'zip'
zip = fields.Integer('ZIP Code',required=True)
country_id = fields.Many2one('res.country',required=True)
city_id = fiel... |
64502f7a78f553e7fc043f57519e50464958fb19 | 462258bffd2e81d9bf1104ea279549a9dad36f1a | avneetkaur1103/workbook | /DataStructure/Stack/sort_stack.py | Python | py | 1,161 | no_license | '''
Variation of sorting a stack without for/while.
We store the elements in function call stacks > pop it there to empty stack at the end (to set up empty base inverient)
and fill it at required place while rewinding.
'''
class Stack:
def __init__(self):
self.data = list()
def push(self,val):
self.data.app... |
97a0ceab55baa25e0e6837a39c033d599da2374b | 44270fad584a41fa95d2ac25f8f2d43907986cd5 | xiaojihe/ARSearch | /httpd_3.py | Python | py | 235 | no_license | from http.server import HTTPServer, CGIHTTPRequestHandler
class Handler(CGIHTTPRequestHandler):
cgi_directories = ["/cgi"]
PORT = 5951
httpd = HTTPServer(("", PORT), Handler)
print("serving at port", PORT)
httpd.serve_forever()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.