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 |
|---|---|---|---|---|---|---|---|---|
33fed51db87de2593a74e928ac0f024bfdd2f81f | a14b9da125536f189559c87ccd2bfe47f6550f7a | weblabdeusto/weblabdeusto | /tools/wcloud/wcloud/test/testinstance_sqlite/core_machine/machine_config.py | Python | py | 2,977 | permissive | # It must be here to retrieve this information from the dummy
core_universal_identifier = 'f2ce65bb-8543-47c1-82bf-44fe191551bb'
core_universal_identifier_human = 'Generic system; not identified'
db_engine = 'sqlite'
db_host = 'localhost'
db_port = None # None for default
db_databa... |
6cb1437a55944c705a1d46fa3b49b21896197550 | 00349b5f89248289192e87def11dcba36a096aaa | CapedHero/crawler-haven | /crawler_haven/crawler_haven/urls.py | Python | py | 1,504 | no_license | """crawler_haven URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... |
ffdf751a1ab37e4b485b0df928e46ac28988d1d4 | 13837b545c10284cecb55e6c41b4c8de90ad51ef | DeadHeadRussell/thesis | /initial_tests/bin/hist_old.py | Python | py | 3,934 | permissive | import subprocess
import aubio
import matplotlib.pyplot as plt
import modal
import modal.onsetdetection as od
import numpy
import scipy.stats
import scipy.io.wavfile
mergebands = True
def compute(data, title):
diffs = numpy.abs(numpy.diff(data))
#diffs = data
#diffs = [d[1] for d in data]
#diffs = numpy.abs... |
8d60b7dcf025cec3230083a44cde334dd3280efa | e2977c3572bc14f01771e405dcdc4e24f32c7805 | openstack/nova | /nova/virt/libvirt/volume/nvme.py | Python | py | 2,510 | permissive | # 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, software
# d... |
14ab2ac14bea89c038425b4cd7b24f5e2b423588 | 05a4cfd24a0fa82a5b1109c456ac784b8df31c0d | akshaykatiha/practicegit | /kotaproject/mastrooms/migrations/0006_auto_20190411_0041.py | Python | py | 662 | no_license | # Generated by Django 2.1.5 on 2019-04-11 00:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mastrooms', '0005_auto_20190410_0204'),
]
operations = [
migrations.RemoveField(
model_name='room',
name='buck... |
e4f73389b618980ec9c0f2fea95c49a26cd7ce83 | 210644743dcfe84f1b2e3069c75f978a9a405c3f | svtirronen/research_project_course | /data_processor.py | Python | py | 26,645 | no_license | import numpy as np
import os
import pickle
import math
import tensorflow as tf
import soundfile as sf
import librosa
from scipy import signal
from datetime import datetime,timedelta
class DataProcessor(object):
'''
Basically just a wrapper for related functionality.
Workflow:
1) Form feature files by... |
0f4f0cda2b16e47f285e38931e5559eb2a34d83b | ccfc4fb57af47dc3aa0a2034ea00a54a9cd82cbc | gaigai1996/SmartGridFraudDetection | /file2.py | Python | py | 810 | no_license | # afairesh mhdenikwn grammwn apo to dataset
import pandas as pd
rawData = pd.read_csv('/home/db/Documents/dipl/export_dataframe1.csv')
data = rawData.drop(['FLAG', 'CONS_NO'], axis=1)
index = data[(data.max(axis=1) == 0)].index
print('Raws with Zero Consumption\n',index)
newData = rawData.drop(index, axis=0)
print(n... |
f31d043e0c37f8182c7c3ed1bd4addb672abcffb | 09457fe44433e64b70f08f6cacc22aa03818fa15 | cadoca1/BigData_Analytics | /Statistical_Programming_with_Python/Code_Data/correlacion.py | Python | py | 4,093 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 13 15:17:46 2020
@author: carlosdonosocabero
"""
#%reset -f
#load basiclibraries
import os
import numpy as np
import pandas as pd
from pandas.api.types import CategoricalDtype #For definition of custom categorical data types (ordinal if necesar... |
b0c40fdb028fe6ef0fe59e3178d47c2b6d36c8db | c7bf2948e120142dd2828c441fb858ea191e3c5b | mode/plotly.py | /plotly/validators/layout/ternary/aaxis/tickformatstop/_enabled.py | Python | py | 509 | permissive | import _plotly_utils.basevalidators
class EnabledValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self,
plotly_name='enabled',
parent_name='layout.ternary.aaxis.tickformatstop',
**kwargs
):
super(EnabledValidator, self).__init__(
plot... |
6cc82c34fad6a83657065e054c389d3d9c40b35d | 83b35d2f651f5da03634b3e070f2f9215335ffd1 | pythongiant/RhymePlay | /RhymePlay/Rhyme/views.py | Python | py | 1,446 | permissive | from django.shortcuts import render,redirect
from . import forms
import pronouncing
Rhyme=[]
points=0
def check(wrd1,wrd2):
if wrd1 in wrd2:
return True
else:
return False
# Create your views here.
def index(request):
return render(request, "Rhyme/index.html", {})
def rhyme(request):
g... |
cd2ef87deedc08d81aec8f92e6af1000bd9a7e35 | 922e9c6fdff5a920c8d458722cf41202c0c6ed97 | fasemoreakinyemi/future-work | /twitter-sentiment-analysis-master/SentimentAnalysis_model_creation.py | Python | py | 7,980 | no_license | # -*- coding: utf-8 -*-
"""SentimentAnalysis_model_creation.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/10sLbuFxz9oR18OjorV9rVD1xshQEvHfu
"""
# Commented out IPython magic to ensure Python compatibility.
# DataFrame
import pandas as pd
# Mat... |
45a0b6ada55d83f603339d326b9940c28115540c | d0354ef494aa41bf72634c4220ea40e346f92987 | NeolithEra/program-y | /src/programy/parser/pattern/graph.py | Python | py | 10,189 | permissive | """
Copyright (c) 2016-2019 Keith Sterling http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, m... |
0a87bac18f3dfdb59f3b8147e58c589f1f75e381 | 9e0a46e38b4927bd756785132a49377f475c976e | andreweckford/capacity_calculation | /capacity_calculation.py | Python | py | 5,367 | permissive | '''
Created on Jan 5, 2015
@author: andreweckford
'''
import genMarkov
import sequence_probability as seq
import channelrhodopsin
import acetylcholine
import calmodulin
import numpy as np
import sys
from time import time
#test
def parseCommandLineArguments():
if ((len(sys.argv) < 7) and ('-d' not in sys.argv)):... |
7b2540a258f089492758e52737eacc505c573786 | 3e53ddaf02df789fa2fc64c1553ffea8dd800641 | MoralCode/vial | /vaccinate/core/migrations/0107_decimal_for_latitude_longitude.py | Python | py | 1,067 | permissive | # Generated by Django 3.1.8 on 2021-04-28 00:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("core", "0106_improved_priority_help_text"),
]
operations = [
migrations.AlterField(
model_name="location",
name="lat... |
2669d312dc0e3bfae0fa6dea9206e45b178c681a | 3930cec5a817c513b8b6fa89d8613e59ddd33de3 | jaminGH/huaweicloud-sdk-python-v3 | /huaweicloud-sdk-cloudide/huaweicloudsdkcloudide/v2/model/stacks.py | Python | py | 9,136 | permissive | # coding: utf-8
import re
import six
class Stacks:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.... |
19914f61e149c2d222500f091c93ccb41f3d45a0 | 37dcd1d97376e69b21913948cbab17d6317efe80 | MAYANK123-code/python- | /index.py | Python | py | 326 | no_license | secret=7
guess=int(input("guess any number: "))
while guess!=secret:
if guess<secret:
print("you need to guess high bruh")
guess=int(input("guess any number: "))
else:
print("you need to trhink low bruh")
guess=int(input("guess any number: "))
print("you guessed the number correc... |
66468b760d96b79351567d368ff6487878501545 | f37db7dd828d8a74895f7b80a3a27c9449c7a633 | abcapo/Computacion-2019 | /58089-Agustina-Capo/clase 3/interfaz_factorial.py | Python | py | 270 | no_license | from factorial import factorial
def interfaz_factorial (number):
try:
result = int(number)
return factorial (result)
except:
return 'error'
def main ():
palabra = ''
result = interfaz_factorial (palabra)
print (result)
main () |
725eeec89996f03e329e53fde017ce45947dded0 | 4ca7a4afd5cd63e72b96d4ea3732ab215b06ff45 | ezbc/scripts_and_logs | /taurus/analysis/co/taurus_plot_co_vs_av.py | Python | py | 26,660 | no_license | #!/usr/bin/python
''' Calculates the N(HI) / Av correlation for the taurus molecular cloud.
'''
import pyfits as pf
import numpy as np
''' Plotting Functions
'''
def plot_av_image(av_image=None, header=None, title=None, limits=None,
savedir='./', filename=None, show=True, av_mask=None, co_mask=None,
... |
bc98ede5cb75027fa54e473cc195aadb33dbac41 | 7b1eab644af35bc2265a7f371cb943ea1943689f | DJRumble/S2DS | /RM-DS-handover/RM-DS/src/model/estimator.py | Python | py | 3,313 | permissive | import pandas as pd
import matplotlib.pylab as plt
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from src.model.base_estimator import BaseModel
from tqdm import *
import os
# from xgboost import XGBRegressor
# from sklearn.multioutput import MultiOutputRegressor
from sklearn.ensemble import E... |
2c26314e9bc973b89c9001e6d3d98178d6e28f79 | d0e4f0cb6db4930723c25b60180344470528b8bd | andrey-tereshchenko/Social-Network-DRF-API | /api/views.py | Python | py | 3,373 | no_license | from django.db.models import Count
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from api.models import User, Post, Like
from ap... |
cff57b988e1796de8f03c845c8fc7478dbf883a2 | de2a3699ae4a33bab6473cd14c147558e4bbb041 | samie820/Imagine | /account/authentication.py | Python | py | 512 | no_license | from django.contrib.auth.models import User
class EmailAuthBackend(object):
def authenticate(self, username=None, password=None):
try:
user = User.objects.get(email=username)
if user.check_password(password):
return user
return None
except User.... |
61459a4e00f1b3ce9ed81be1514768cc0feac3d0 | 376441b4e985957803dff5df21faa13b257f0612 | gmijenes/autogoal | /docs/make_docs.py | Python | py | 8,858 | permissive | # Convert examples in this folder to their corresponding .md files in docs/examples
import os
import re
import inspect
import textwrap
import datetime
import yaml
from pathlib import Path
def hide(line):
return ":hide:" in line
def build_examples():
current = Path(__file__)
folder = cu... |
d62113e7d990c09f98d2c112dec93ee53300dde1 | 831ee60574797710f3afc782b8d07a41e869853a | shafikshaon/banquet | /configuration/models/meal_config.py | Python | py | 1,201 | no_license | from django.db import models
from gist.models import TimeLog, Activity, Key, Actor
__author__ = 'Shafikur Rahman'
class MealConfig(TimeLog, Activity, Key, Actor):
breakfast = models.DecimalField(
max_digits=5,
decimal_places=2,
blank=False,
null=False,
help_text='This wil... |
9101d2197c87418c840ebefcddf74a6f915130b7 | 047d6cac684ced9a23839c192c3270031997b32d | kushal-h/Article-DRF | /api_app/serializers.py | Python | py | 319 | no_license | from rest_framework import serializers
from .models import Article
class Articleserializers(serializers.ModelSerializer):
class Meta:
model = Article
fields = [
'id',
'title',
'author',
'comment',
'email',
'date'
] |
890fb671675d05174637cf8285d74e2aaffe7867 | 01c36ddf3ddfb76b96b182b11ac60da01be00164 | AtlasBID/CalibrationResults | /scripts/dstar.py | Python | py | 1,981 | no_license | #
# Do the D* calculation (scaling template D* files to the final D* values).
#
from comboFitCommands import dumpCommandResult, listToString, rerunCommand, dumpFile, dumpTitle
from FutureFile import FutureFile
import comboGlobals
#
# We need a template analysis and something to call it when we are done.
#
def dstar(... |
a8a347a8c44e454125c9b61d2665755b106812a6 | 737920c9fc9cbae2c61e778c1151ecfdec56df29 | AmyShackles/algo-practice | /LeetCode/Easy/Python3/tests/test_sumofalloddlengthsubarrays.py | Python | py | 794 | no_license | import unittest
from Python3.sumofalloddlengthsubarrays import Solution
class TestsumOddLengthSubarrays(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_1(self):
# For sanity checking:
# Input: arr = [1,4,2,5,3]
# Output: 58
se... |
f884eae3d9cfea4b454bb9369546c4b812120eb9 | 533636f33a06c876a2d4ea674a11eb4cef9fc7ee | margaret254/Pitch-Upload | /app/email.py | Python | py | 418 | permissive | from flask_mail import Message
from flask import render_template
from . import mail
def mail_message(subject,template,to,**kwargs):
subject_pref = 'pitch'
sender_email = 'maggiemwas91@gmail.com'
email = Message(subject, sender=sender_email, recipients=[to])
email.body = render_template(template + ".... |
c8eecc9bf8f9b4bc7747a9e3dc53c14d56af50f7 | f007594092de6c5abf65448225fb72d931ff2da6 | kepoling/forge | /forge/_internal_plugins/manage_plugins/manage_plugins_logic/plugin_puller.py | Python | py | 915 | permissive | """ Plugin Puller """
import subprocess
from pathlib import Path
from git import Repo
from git import Git
from colorama import Fore
class PluginPuller:
""" Plugin Puller Class Def """
def __init__(self, config_handler):
self.config_handler = config_handler
def pull_plugin(self, plugin_name, branch... |
b509544f378c92256eef7a3a350e0c25592e9d43 | f9f8be8ef4d3b14ef3544cb4074ab3064fd594b0 | macropin/ovm-ctl | /ovm_ctl/console.py | Python | py | 2,404 | no_license | import os
from subprocess import Popen
from tempfile import NamedTemporaryFile as tmpfile
from show import getvmby
# TODO A few things about this need a rewrite.
# Being able to see password on process list, big issue on multi-user systems.
# An attempted (unfinished) rewrite can be found in console-rewrite.py,
# but ... |
fd2c7d256049a626ca89e548799f9547f802d7e2 | 697f6815ad7be8ce2efddf25897efaa493d3fa0d | sohamdighe14/ngoconnect | /src/accounts/migrations/0005_donorprofile_owner.py | Python | py | 693 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-01-27 18:33
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependenc... |
5e47c31f5b013c201a44186ecf479a491a3eafff | 55575000d88e9f8bbb66dba7d05d6f8d1f7651da | eddjou/cogsci131works | /hw10/demo4.py | Python | py | 929 | no_license | import pandas as pd
import csv
import numpy as np
import matplotlib.pyplot as plt
def surprisal(w):
return -np.log2(w)
def H(p):
s=0
for i in p:
s+=-i*np.log2(i)
return s
data=pd.read_csv("Assignment10-WordFrequencies.csv",header=None)
shape=int(data.shape[0])
decishape=int(shape/10)
dic=[]
... |
7407adcc0671a332b2f22d3a2b735ebf4a4a04fd | 08b758a90103618c31ead562727f05a43b7c07fb | da-semenov/loft_test | /blog/posts/forms.py | Python | py | 1,096 | permissive | from django.forms import ModelForm
from .models import Comment, Post
class PostForm(ModelForm):
"""
Класс для формы создания новой публикации.
"""
class Meta:
# на основе какой модели создаётся класс формы
model = Post
# указываем, какие поля будут в форме
fields = ['... |
c6fc6378d1fd4f4405a4c14da4d1735973120133 | ebdaea1dd9152c973f7b2505e208159c536f4b12 | df413/leetcode | /merge_two_bin_trees/main.py | Python | py | 742 | no_license | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x: int):
self.val = x
self.left = None
self.right = None
class Solution(object):
def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode:
"""
:type t1: TreeNode
:type t2: TreeNo... |
c13e323cdeb2ffc44582c09bfa2923e1fd5e2c94 | bc01c778818689a75ed91097c9e0c5e820d91c02 | mabudrais/LCLBinding | /parser/generated/python/test/ValEdit.py | Python | py | 18,266 | no_license | from lcltype import *
from dialogs import *
from lresources import *
from Grids import *
from StdCtrls import *
from Controls import *
from Classes import *
from MainPasObject import *
#import end
def CreateTKeyOptionsFromInt(i):
dic={1:"keyEdit",2:"keyAdd",4:"keyDelete",8:"keyUnique"}
return CreateSetFormint(i... |
545b9437bab5665d9484ebe07f38854b35b6eddf | f9a872b60de7d2aa2440acad7092f084073884d7 | dev20180319/devrepo | /weixinapp/urls.py | Python | py | 441 | no_license | """
自定义的路径
定义echarts的URL模式
"""
from django.conf.urls import url
from werobot.contrib.django import make_view
from . import weixinrobot
from . import views
app_name = 'app_weixinapp'
urlpatterns = [
# 主页-显示菜单
url(r'^robot/', make_view(weixinrobot.myrobot), name='robot'),
url(r'^getsignconfig$', views.g... |
476175a858e9957a4da35beee490299a4627981c | 0f68c85aeb91e603750619d6e2988f2b59a62f03 | thommms/python-projects | /day2_Operator.py | Python | py | 417 | no_license | #!/bin/python3
import sys
from math import floor
if __name__ == "__main__":
meal_cost = float(input().strip())
tip_percent = int(input().strip())
tax_percent = int(input().strip())
tip=meal_cost * (tip_percent/100)
tax=meal_cost * (tax_percent/100)
totalCost=tip+tax+meal_cost
... |
c623ec13f8b9a273d9a82cf17938fdbc691ff3ba | 9a6d6ccca3c2b875996ee6c25f4282072bcb9df7 | nuwana9876/Deep_learning_study- | /R-CNN/utils/data/create_bbox_regression_data.py | Python | py | 3,443 | no_license | import os
import shutil
import numpy as np
import utils.util as util
if __name__ == '__main__':
voc_car_train_dir = '../../data/voc_car/train'
# ground truth
gt_annotation_dir = os.path.join(voc_car_train_dir, 'Annotations')
jpeg_dir = os.path.join(voc_car_train_dir, 'JPEGImages')
cla... |
058ed00c995f9a95ff4f4efa4a358436cd065f7f | b03cd4da046a0733e2c62007f5abeb903ba5cbb9 | ANDRESOTELO/holbertonschool-higher_level_programming | /0x11-python-network_1/2-post_email.py | Python | py | 564 | no_license | #!/usr/bin/python3
'''
Write a Python script that takes in a URL and an email, sends a POST
request to the passed URL with the email as a parameter, and displays
the body of the response (decoded in utf-8)
'''
import sys
from urllib import request, parse
if __name__ == '__main__':
url = sys.argv[1]
# Data d... |
db3da7d7d01d4fb86ff38bf9cd83733738f9afd1 | 22a0071c0009069098d977c8aeafbda47ae4639c | C2SM-RCM/emiproc | /tests/test_crop_grid_with_shape.py | Python | py | 4,456 | permissive | """Test case of a grid that intersects a shape."""
import shutil
import numpy as np
import geopandas as gpd
from shapely.geometry import Point, Polygon
from emiproc.inventories.utils import crop_with_shape
from emiproc.regrid import (
geoserie_intersection,
)
from emiproc.inventories import Inventory
from... |
2856febd001280eec04ad3cb59704854125176a1 | 71709dd192a2b7baf78fbdfc9b6ff8d2340e3dda | Anurag-12/learning-python | /enumerate_fucntion/main.py | Python | py | 728 | no_license | # enumerate(iterable, start=0)
# The data structure that we want to iterate
# The index from where we want to start our iteration
l1 = ["Bhindi", "Aloo", "chopsticks", "chowmein"]
# i = 1
# for item in l1:
# if i%2 is not 0:
# print(f"Jarvis please buy {item}")
# i += 1
for ... |
39ea465bc5bc9706e7ea30fd62f8552779e37bb6 | 2bbeaee829294ee3ef01f06dbceeb8c049fadf6f | cc-archive/blog_analysis | /technorati_report.py | Python | py | 1,404 | no_license | import urllib2
import BeautifulSoup
def grab_urls():
url = 'http://www.technorati.com/pop/blogs/'
s = urllib2.urlopen(url).read()
u = unicode(s, 'utf-8')
b = BeautifulSoup.BeautifulSoup(u)
ol = b('ol')[0]
links = ol('a', {'class': 'url'})
urls = [a['href'] for a in links]
return urls
d... |
057e9b88664e59acf1e0f184d8652191578f749a | 21328deccb0188a9633a4f0abd0e282696b184aa | Dihfahsih1/Multi-School-Management-System | /schools/urls.py | Python | py | 25,318 | no_license | from django.conf.urls import url, include
from django.urls import path
from . import views
from django.contrib.auth.views import *
urlpatterns = [
url(r'^login_user/$', LoginView.as_view(template_name='home/login.html'), name='login_user'),
url(r'^logout_user/$', LogoutView.as_view(), name='logout_user'),
... |
0a33acd70ea05a654c1cf189bbc804af6bdd2f4b | c3dd087f888e2a276f1af566f34366571335329e | 564045408/deepLearning | /tensorflowPro/study/study_self_basic/variables_demo1.py | Python | py | 584 | no_license | '''
tf.constant 创建常量
tf.Variable 创建变量
tf.initialize_all_variables 初始化变量
session.run 运行会话
'''
#导入tensorflow模块,并调用tf
import tensorflow as tf
#创建一个名为x的常量,赋值35
x = tf.constant(35, name='x')
#创建一个名为y的变量,定义方程x+5
y = tf.Variable(x + 5, name='y')
#初始化变量
model = tf.initialize_all_variables()
#创建会话,在with结束后自动关闭会话
with tf.Session... |
d5d8887094d225082d06fb8d2d6495ac854eef88 | dd815df32b7074f48039392eda834f553590661e | BeJulien/TP-Python | /osrm/types/step.py | Python | py | 776 | permissive | # coding: utf-8
from dataclasses import dataclass
from dataclasses import field
from osrm import DEBUG
from osrm.types.maneuver import Maneuver
@dataclass(repr=DEBUG)
class Step:
distance: float = field(default_factory=float)
duration: float = field(default_factory=float)
name: str = fiel... |
7988eda1c46340ebbbdd44e0e7767bd90d63d6f3 | 727ac1ccd975568dfd270ad2f993701607dbf38f | rohitsingla2611/Python_Projects | /All Files/OpenCv/Face Detection/FaceDetection3.py | Python | py | 1,962 | no_license | # OpenCV program to detect face in real time
# import libraries of python OpenCV
# where its functionality resides
import cv2
# load the required trained XML classifiers
# https://github.com/Itseez/opencv/blob/master/
# data/haarcascades/haarcascade_frontalface_default.xml
# Trained XML classifiers describes some feat... |
af3c14d8f6411e250e122c0aff3daaa62ea7d3d4 | ed42c74da29714df8925d5c2868e913575b3987f | test-repo-billy/azure-sdk-for-python | /sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py | Python | py | 27,680 | 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... |
5ca700769d1ba8acffd33578082c10896b0de9ee | c7a6771f1a743f9213f1ee220b6bbd10e8c22656 | x249wang/pyopendatato | /setup.py | Python | py | 909 | permissive | # -*- coding: utf-8 -*-
import os
from setuptools import setup
here = os.path.dirname(__file__)
def read_requirements(file_):
with open(os.path.join(here, file_)) as f:
return sorted(list(set(line.split("#")[0].strip() for line in f)))
install_requires = read_requirements("requirements.txt")
with o... |
5b9473503be7c5b06cdad6afbbfaf2abadb205ea | 7c11139a3e7bd8d83b9ce06f418a048cd00b52f8 | peace2017/stepik_auto_tests | /part_02/lesson7_step6.py | Python | py | 569 | no_license | import math
from selenium import webdriver
link = "http://suninjuly.github.io/alert_accept.html"
browser = webdriver.Chrome()
browser.get(link)
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
button = browser.find_element_by_tag_name("button")
button.click()
alert = browser.switch_to.alert
alert.acc... |
c8567e5df583d97890ffabe70d41e06952daee69 | 42af70f1ffb7b9ed9c729f0d1a1ab5a7d720af3d | MrDeclanCoder/PythonExercise | /stringutil.py | Python | py | 1,190 | no_license | from functools import reduce
DIGITS = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
def char2num(s):
return DIGITS[s]
def str2int(s):
return reduce(lambda x, y: x * 10 + y, map(char2num, s))
r = str2int('1596345654654564')
print(r)
def normalize(name):
# return na... |
116a9c3ce8443af90ba752b57091e1b92aeed017 | 21f279c60d6cfee5bf979559b62853e5019471af | alfalimajuliett/masters-thesis | /arcpy/benchmarks/writing_one_raster.py | Python | py | 220 | no_license | import arcpy
arcpy.env.overwriteOutput=True
# ---
@profile
def writing_one_raster():
src = arcpy.Raster('data/rasterio/RGB.byte.tif')
src.save('data/rasterio/arcpy_writing_one_raster.tif')
writing_one_raster()
|
4b2ff25dbe9a00a5b693d14969842183c2f990d2 | 30172856d29abf271be89c19141152c85ad212dc | Navajyoth/proman | /apps/knowledge/tests/test_models.py | Python | py | 627 | no_license | from django.test import TestCase
from model_mommy import mommy
from apps.knowledge.models import Quote, Article
from apps.utils.tests import console_log
class QuoteModelTest(TestCase):
def setUp(self):
self.item = mommy.make(Quote)
def test_quote_model(self):
self.assertTrue(isinstance(sel... |
9c103f0519dd407eac47e6ec2d6445dcf7fa3808 | 38d26185ebf12860f7423d46b41f2820dc04c8df | wanpark/pre-rpg-py | /src/rpg/__init__.py | Python | py | 830 | no_license | # -*- coding:utf-8 -*-
import sys
import pygame
from pygame.locals import *
from rpg.constants import *
import win32gui
import rpg.event
import rpg.scene
import rpg.title
# main
def main():
pygame.init()
win32gui.MoveWindow(
pygame.display.get_wm_info()['window'],
SCREEN_RECT.left, SCREEN_RE... |
cbca40c28d2473fb48e490293ee5e61fd52a025b | 5614d4c4357c785a4f67f7d1a64926952331ef52 | jersey99/litex | /test/test_cpu.py | Python | py | 3,176 | permissive | #
# This file is part of LiteX.
#
# Copyright (c) 2021 Navaneeth Bhardwaj <navan93@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
import unittest
import pexpect
import sys
class TestCPU(unittest.TestCase):
def boot_test(self, cpu_type, cpu_variant="standard"):
cmd = f'litex_sim --cpu-type={cpu_type} -... |
8d1f43072efac1d08088d6b3b80085b607d7eae1 | 221209a26c2ef57fbb9b27ff00390c3b4e2af9af | HabanaAI/Model-References | /PyTorch/audio/hubert/utils/feature_utils.py | Python | py | 7,808 | permissive | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# https://github.com/pytorch/fairseq/blob/265df7144c79446f5ea8d835bda6e727f54dad9d/LICENSE
# Copyright (C) 2023 Habana Labs, Ltd. an Intel Company
import logging
from pathlib imp... |
080436a83e883d74d2658ea657f56d401e11bef3 | 9459dac9b3107344f00c9cc7e5cb9c5a36fce7b4 | Amansoni3/MaterialManagement | /MaterialManagement/EmployeLoginView.py | Python | py | 2,738 | no_license | from django.shortcuts import render
from . import PoolDict
from . import Pool
def EmployeeLogin(request):
try:
result=request.session['EMPLOYE']
return render(request, "EmployeDashboard.html",{'result':result})
except Exception as e:
return render(request, "EmployeLogin.html")
def ... |
d588fecfa5eed9cd86b6acbfc4dbb87c1e90b9eb | 2ed6a8539f3928905e31bae27b3c03ae992e8bc1 | doyeon-kim-93/algorithm | /알고리즘10일차_0217/백트래킹 개념 재귀호출.py | Python | py | 1,444 | no_license | #재귀로 반복문 표현
# for i in range(3):
# print('HELLOW')
#
# def printHELL(n):
# if n == 1:
# print('HELLOW')
# else:
# print('HELLOW')
# printHELL(n-1)
# printHELL(3)
#
# def printHELL(n):
# if n < 3:
# print('HELLOW')
# printHELL(n+1)
# printHELL(0)
# def printHELL(n)... |
5590007977856080710a3e4fd55405af9f5a5ab1 | 997f1fbf9b1c03abcfe0afbc4ac04c6e83a79511 | Portfolio-Projects42/UsefulResourceRepo2.0 | /MY_REPOS/awesome-4-new-developers/tensorflow-master/tensorflow/lite/experimental/microfrontend/python/kernel_tests/audio_microfrontend_op_test.py | Python | py | 6,911 | permissive | # Copyright 2018 The TensorFlow Authors. 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
e478100d247f4c929a6490b1820e41b49ad548b5 | 5163b6a87316bd2cbd74ee322dbce3e382439a1d | mwiederrecht/Springboard-Capstone | /captone_info/floral_vs_stripes_bestsofar_4.py | Python | py | 4,544 | no_license | import os
from datetime import datetime
import tensorflow as tf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from keras.callbacks import EarlyStopping
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv2D, Flatten, Dropout... |
f09928bd90a867e34c1e092af90b73813d0291e5 | bd4d4d1724f509dac966bca066b8f25109a78483 | chick-tiger/ansible_fgt_modules | /v6.0.2/system.replacemsg/fortios_system.replacemsg_spam.py | Python | py | 8,311 | permissive | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2018 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
dabdda8c78ac333e98369770756f25ea2775ea10 | d78f5220ebf300b44f450b06e7fc1a9455271bef | SaschaKaden/Wahlatlas | /util/cell.py | Python | py | 233 | permissive |
class Cell:
def __init__(self, lon, lat):
self.pixel = 0
self.id = ""
self.potential_scale_wk = 0.0
self.sinus = "UNDEFINED"
self.lon = lon
self.lat = lat
self.gru_bt = 0
|
6865c971c65efdbe4a0c7c7282cd7b5a27720a3e | d9a32c8c5008710d35c593765d5cd13561a4594c | zhaopingsun/lrose-core | /codebase/make_bin/createMakefile.am.app.cidd.py | Python | py | 18,178 | permissive | #!/usr/bin/env python
#===========================================================================
#
# Create makefile.am for a cidd package
#
#===========================================================================
import os
import sys
import shutil
import subprocess
from optparse import OptionParser
from dateti... |
6939c82cf06a6d49c7766500a23dd7eb3fd49fef | baa8e2e732b0bd126bdf85a9e1d806d458170a87 | HBinhCT/Q-project | /hackerearth/Basic Programming/Implementation/Basics of Implementation/Equal Median/test.py | Python | py | 507 | permissive | import io
import unittest
from contextlib import redirect_stdout
from unittest.mock import patch
class TestQ(unittest.TestCase):
@patch('builtins.input', side_effect=[
'1',
'7',
'1 2 3 3 5 6 7',
'4 6 8 8 9 9 9',
])
def test_case_0(self, input_mock=None):
text_trap =... |
3beb7cc36fdf34ca0fc4030e177d9ae4368343cb | 564e40e21e5e21a4e4d1365edbf18f1fabbc2f41 | zhang97914/Paillier-LWE-based-PHE | /jointly_learning_with_encryption_demo_v2.py | Python | py | 5,812 | no_license | import torch
import torch.nn as nn
from LeNet import LeNet
from torchvision import datasets, transforms
import copy
import torch.optim as optim
import argparse
import platform
import math
import time
import numpy as np
import collections
class PublicKey:
def __init__(self, A, P, n, s):
self.A = A
s... |
6043b88a52b9c7c16b731397ffdf7efdb0f31a0c | 00de0f8f005761e2180b10e5552417d3b1938857 | Sida63/Machine-learning-SVM_kmeans_image_recognition | /TestKsvm.py | Python | py | 11,602 | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image, ImageDraw,ImageFont
'''
set up training_set, training_labels and so on.
Like initializtion
'''
accuracyresult=[]
for k_num in range(1,11):
training_set=[]
training_labels=[]
svm_params = dict( kernel_type = cv2.SVM_LINEAR,... |
fcf3539382e384fd2bed59e4a59ca467f164fbd9 | 45068bdb3a84aa4112a074e7feb40c806ecf60b6 | roma-p/kioku | /kioku/anki_preprocess/ankiParser.py | Python | py | 5,235 | no_license | import sys, os, csv
import logging
import sqlite3, datetime, configparser
from shutil import copyfile
from japanese.Japanese_DB_handler import Japanese_DB_handler
import configuration as configuration
import helpers as helpers
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)
# def _parseCo... |
72cc7b126620c5968b959221990e7b92c4d21b69 | 40a78b82e9f4997a767dbd8414796201d8a7ed67 | ZICCORP/humanoid | /sapien/urls.py | Python | py | 1,033 | no_license | """sapien URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.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-based ... |
d1bec11f1e9a70ea595a5861f11b100b333cab80 | 83084c789ab71a17dd3eb355a130d153b534b714 | Qaminono/Yahoo_Finance | /rest_service/yahoo_finance/urls.py | Python | py | 819 | no_license | """yahoo_finance URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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... |
26de9cf54680ffcd23480d02eca3ae55fe17d2ee | 7737e55bad3545946343c882a91268e599c0f26a | johmedr/Geon | /tests/GApplicationCheck.py | Python | py | 1,065 | permissive | import sip
for api in ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]:
sip.setapi(api, 2)
from Geon.app import GApplicationWindow
from Geon.core import *
from Geon.utils import *
from PyQt4.Qt import SIGNAL
app = GInit()
layerset = GLayerSet()
db = GPostGISDatabase()
basemap = GR... |
fcca08310bb8b468f053f35dfaaafbe4a00b6100 | 100251a806b4f0f05971506f337a501f2cf163ff | C-Radius/Krita-Settings | /pykrita/krita-redesign/nuTools/ntadjusttosubwindowfilter.py | Python | py | 1,672 | no_license | """
Plugin for Krita UI Redesign, Copyright (C) 2020 Kapyia
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.... |
a8b9f06652d368a1ff9c575522c8286c85ffad0c | 3d90fe64ca5a6600bc27227044a14ca3a3a3c0c2 | lipengyu/cle | /cle/utils/op.py | Python | py | 1,248 | no_license | import ipdb
import numpy as np
import theano.tensor as T
def dropout(x, p, theano_rng):
if p < 0 or p > 1:
raise ValueError("p should be in [0, 1].")
mask = theano_rng.binomial(p=p, size=x.shape, dtype=x.dtype)
return x * mask
def logsumexp(x, axis=None):
x_max = T.max(x, axis=axis, keepdims... |
cf517b1082e373bcbc306b28274c4c2365f7fbe4 | cf6413ba8fe54c4be9ca3930db2f1c70295eea59 | naodell/Project-Euler | /Page 1/problem_26.py | Python | py | 1,396 | no_license | '''
A unit fraction contains 1 in the numerator. The decimal representation of
the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.... |
771ed652aa02731fbfb8ce92fae777ea93f08d64 | ffbeabb69d436c1a8fb47897e15a7692acdcf1a5 | siddhant-pradhan/private-pgm | /examples/hdmm.py | Python | py | 3,299 | permissive | from mbi import mechanism, FactoredInference
import benchmarks
import numpy as np
from scipy.sparse.linalg import lsmr
import argparse
from ektelo.matrix import Identity, EkteloMatrix, Kronecker
"""
Run HDMM with and without graphical-model inference on the adult dataset.
McKenna, Ryan, Gerome Miklau, Michael Hay, an... |
bddc1b2c558c808b39b3326db59966223f384f53 | f7217c4a9172fc37c36748ce604ba37e657d08ce | OpenIxia/ixnetwork_restpy | /ixnetwork_restpy/testplatform/sessions/ixnetwork/topology/dhcpv4relayagent_f4cc56bb53d1903e9ec0dfc563d37d9c.py | Python | py | 23,695 | permissive | # MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... |
af9781f1f4ac126ac78909c2c86caefa1e3b6c45 | 5b382658bfbc5dfed822178c636adb90181b0f47 | embassynetwork/lovinglanguagebot | /loving.py | Python | py | 3,818 | no_license | #!/usr/bin/env python
import os, sys, time, re, datetime
from slackclient import SlackClient
# get these tokens from slack or ask someone to give them to you.
# then `export LOVING_LANGUAGE_SLACK_TOKEN='xoxb-xxxxxxxxxxxxxxxxxxxxx'`
token = os.environ.get('LOVING_LANGUAGE_SLACK_TOKEN')
bot_id = os.environ.get('LOVING... |
86387a808232f2f188a63618d46cf4d165e246d1 | 2fd4a9229795a25c082c2e05530352086a3819ad | e212156822000/DeepVideoAnalytics | /dvaapp/tasks.py | Python | py | 40,887 | permissive | from __future__ import absolute_import
import subprocess, sys, shutil, os, glob, time, logging, copy
from PIL import Image
from django.conf import settings
from dva.celery import app
from .models import Video, Frame, TEvent, Query, IndexEntries, QueryResults, AppliedLabel, VDNDataset, Clusters, \
ClusterCodes, Regi... |
4439c7ec279e0ee999792bfc1c4f053b61c2ecc3 | 85cafc6af06ecccdcf823b083f6eff3adf98b7ef | MusicAsCode/ardour2fxp | /tests/test_ardour2fxp.py | Python | py | 2,556 | permissive | # -*- coding: utf-8 -*-
"""Tests for 'ardour2fxp' script."""
import hashlib
import os
from os.path import dirname, join, exists
import pytest
from ardour2fxp import main
TESTDATA_DIR = join(dirname(__file__), 'testdata')
TESTOUTPUT_DIR = join(dirname(__file__), 'testoutput')
def sha1_digest(fn):
with open(fn,... |
0eaf30171db1b25f04d3b46e54f7706e8e452351 | f0188ad4e4a1eb2a58cd18d43b082cfd5b57ad4b | RishiBhat/KoshurDailyBlogs | /home/views.py | Python | py | 5,442 | no_license | #playing up with the import export files in the django and printing out the pdf files here!!
import io
from django.http import FileResponse, response
from reportlab.pdfgen import canvas
#---------------------------------------->
#creating a openpyxl library to import and export the workbook
from django.http i... |
7a7b93e7ef1e5ea51e00194998fd085eed070a28 | 5f34f19f183234313c946ba0f5ee14756f66f208 | tylerharrold/Fantasy_Stats_ML | /fantasy_football_rbm_catagorization_test.py | Python | py | 1,069 | no_license | import rbm
import pandas as pd
import testing_tools
import os
from pathlib import Path
# traning dataset path
TRAINING_SET_PATH = "RBMTrainingDataset/training_set.csv"
TEST_SET_PATH = "FormattedFantasyData/2018_data.csv"
NUM_DATAPOINTS = 22
# import our training dataset into a dataframe, then immediately recast i... |
96a9f6f51fde5c9e3692e4622dec2a0a3c95a5a6 | 11d37d96e6ad7527d762e0ccec46e0bd9a5003e8 | prabisonshakya/algorithmes19a | /classes/Order.py | Python | py | 1,687 | no_license | from classes.connection import MyDb
class Order:
def __init__(self):
self.my_db = MyDb()
def add_order(self, tbl, ordered_items_list):
#orders -> tbl_no
qry = "INSERT INTO orders (tbl_no) VALUES (%s)"
values = (tbl,)
order_id = self.my_db.insert_with_id_return(qry, val... |
eb3bcf46dec5b2b74c4fa75042dd719bb415a702 | e3a908b7ca1b5b69be1c18de7c0e4626735319bf | szaboeman/adventOfCode2015python | /day16/day16.py | Python | py | 1,679 | no_license |
import sys
import re
MFCSAM = {
'children': 3,
'cats': 7,
'samoyeds': 2,
'pomeranians': 3,
'akitas': 0,
'vizslas': 0,
'goldfish': 5,
'trees': 3,
'cars': 2,
'perfumes': 1,
}
def readInput():
with open("input.txt") as file:
data = file.read()
file.close()
re... |
369e1be28840e6b39345d383af2f9e71a6b0bc77 | bb0d2191ef3f365c1c0ec3ac6c0788f48aad5b95 | abhishekunique/rllab | /sandbox/rocky/tf/envs/vec_env_executor.py | Python | py | 1,670 | permissive | import numpy as np
import pickle as pickle
from sandbox.rocky.tf.misc import tensor_utils
class VecEnvExecutor(object):
def __init__(self, envs, max_path_length):
self.envs = envs
self._action_space = envs[0].action_space
self._observation_space = envs[0].observation_space
self.ts ... |
bb6984ad09a8401cb0bc3f84582f7fb3643bd200 | 4a3a73410dd43cbac1ecb0f6fc2f24524771f200 | suuungwoo/AtCoder | /ここまで解いたら/ABC096C.py | Python | py | 470 | no_license | # https://atcoder.jp/contests/abc096/tasks/abc096_c
H, W = map(int, input().split())
grid = [[i for i in input()] for i in range(H)]
jud = 'Yes'
for i in range(H):
for j in range(W):
if grid[i][j] == '#':
try:
if grid[i-1][j] == grid[i][j-1] == grid[i][j+1] == grid[i+1][j] == '... |
953b64934666bbb3fc4ca424fd14e8af8fed4577 | 148dbc8fd628d7b028a4a9c953c4a710c264a752 | Hassan-Mallah/Permanent-Backpack | /Collections - Deque.py | Python | py | 698 | no_license | # Collections - Deque(deck)
from collections import deque
d = deque("Hello")
print(d)
d.append('4')
d.append(5)
print(d)
d.appendleft(6)
print('appendleft', d)
d.pop() # remove last element
print(d)
d.popleft() # remove 1st element
print(d)
d.clear()
print(d)
d.extend('World')
print((d))
d.extendleft('Hey') ... |
941b37f05c82dadf17646e0c9d5a98bda98d703e | fb1331bb87b30670f95128ba7e1ce8383507750b | LayNath242/python-web-sracpy | /scraArch/scraArch/pipelines.py | Python | py | 290 | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
class ScraarchPipeline(object):
def process_item(self, item, spider):
return item
|
a01387a498840fa41dc027231dbc162f4362527e | 1c309b2ac091a9b832256d95c13575a2081cf10d | abinm2/python_practice | /Nearest_leaf.py | Python | py | 2,614 | no_license | # A
# / \
# B C
# / \ / \
# D E F G
# / / \
# H I J
# / \
# K L
# / \ / \
# M N O P
class NewNode:
def __init__(self, key):
self.key... |
2686deef152473b3b4ff2523999556e100a28098 | 28c5a3ed4fb2d45fd99dcd0dbd3b7e200bf723ad | gromakovsky/External-Sorting | /util.py | Python | py | 343 | no_license | import os
from tempfile import TemporaryDirectory
import uuid
_dir = TemporaryDirectory(dir=os.getcwd())
_dir_name = _dir.name
# TemporaryFile is not used because we need to reopen files
# NamedTemporaryFile also doesn't guarantee that file may be reopened
def tmp_file():
return open(os.path.join(_dir_name, uui... |
1cb2aec8a0eff60534b66cdedea63d7ea59845a5 | 9756ffa87a884e4eda4bfbf08aecc1445fd793a4 | Curly-Mo/tf_sandbox | /audio_gen/feature.py | Python | py | 1,494 | permissive | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.style as ms
import librosa
import librosa.display
ms.use('seaborn-muted')
audio_path = librosa.util.example_audio_file()
y, sr = librosa.load(audio_path)
def mel(y, sr, n_mels=128):
S = librosa.feature.melspectrogram(y, sr=sr, n_mels=128)
... |
6a242d65960a287285f52f8744714db293a95531 | 6b8d98fdfaf60c061f64e861ef37260614b9958c | Santhosh-Chidambaram/NotesBlog | /notes/urls.py | Python | py | 1,171 | no_license | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from .views import *
urlpatterns = [
path('',homeView,name='home'),
path('about',about,name='about'),
path('add_notes',NotesAddView.as_view(),name='add_notes'),
path('myposts',myposts... |
cab8f5cad4d81e17fa505e79a27b1ffed7401701 | e60ca8c0e6a87562fcbcbd73048afb2dd114c4ee | xyz-wr/django_blogapp | /mysite/blog/migrations/0002_auto_20200730_2020.py | Python | py | 533 | no_license | # Generated by Django 3.0.8 on 2020-07-30 11:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='post',
options={'ordering': ('-modify_dt',), 'v... |
969f9cae42246b33d7ed1b7130affc82f868a04f | b58f3877eee9d4a07b2b5bab18cf8bac105d41d5 | bbahiam/OpenAeroStruct | /openaerostruct/structures/compute_thrust_loads.py | Python | py | 4,211 | permissive | from __future__ import division, print_function
import numpy as np
import openmdao.api as om
from openaerostruct.structures.utils import norm
from openaerostruct.utils.constants import grav_constant
class ComputeThrustLoads(om.ExplicitComponent):
"""
Compute the loads on the structure due to the thrust of en... |
2121dcbacad0b326aee4dd5167a5727f928c5a80 | db2cf10768663de4d63b606e1572e62aab4b3ea9 | Aasthaengg/IBMdataset | /Python_codes/p03638/s567327028.py | Python | py | 408 | no_license | H,W = list(map(int,input().split()))
N = int(input())
A = list(map(int,input().split()))
cnt = 0
L = []
i = 1
while cnt<H*W:
if A[i-1]>0:
A[i-1]+=-1
L.append(i)
cnt+=1
else:
i+=1
for i in range(H):
out = [0]*W
if i%2==0:
for j in range(W):
out[j]=L[W*i... |
8181445a5c2849cc3d0cdc86a26f3019ab05a3b0 | ce6609147830b309eaf583806f80105df15e6bb7 | emiborioni/joda_django | /config/urls.py | Python | py | 1,504 | no_license | """jodas URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... |
58cae11a2c02d89679b3950dbccc6bdeb7f6d385 | 9e46835221c39c4dd809a72c40479b2953ae6b62 | HarperHao/python | /lesson/test.py | Python | py | 580 | no_license | """
编写函数
接受一个字符串
返回一个元组
元组第一个是大写字母个数,第二个是小写字母的个数
"""
def count(a):
b = [0, 0]
for i in a:
if i.isupper():
b[0] = b[0] + 1
elif i.islower():
b[1] = b[1] + 1
b = tuple(b)
return b
a = input("请输入字符串:")
b=count(a)
print("源字符串为:", a)
print("统计结果为:", b)
def __x(se... |
87c140b192921a1ad507170091b33ea068012521 | f352c6bcad007d8512b65e39efb0a6fedd8623d9 | rodrigomoliveira1/ross | /ross/stochastic/st_rotor_assembly.py | Python | py | 31,552 | permissive | """STOCHASTIC ROSS Module.
This module creates random rotor instances and run stochastic analysis.
"""
from collections.abc import Iterable
import numpy as np
from ross.rotor_assembly import Rotor
from ross.stochastic.st_bearing_seal_element import ST_BearingElement
from ross.stochastic.st_disk_element import ST_Dis... |
a0ebf43089ae5ac570347cc876762a0e6ad7b961 | 0c26f33d1a0444170572a9ab0ddc9bb218f4b3f7 | sfeeney/hh0 | /parse_hh0_data.py | Python | py | 36,432 | permissive | import numpy as np
import re
import os
import matplotlib.pyplot as mp
c = 299792.458 # km s^-1
def z2d(z):
q_0 = -0.55
j_0 = 1.0
return c * z * (1.0 + 0.5 * (1.0 - q_0) * z - \
(1.0 - q_0 - 3.0 * q_0 ** 2 + j_0) * z ** 2 / 6.0)
# define Riess et al fitting and rejection functions
def ... |
d4d4992b407070966aa5430647c99f1433ab3a4d | f7303eaea7a1b22317573a0ac8ab30748e7d39ad | johnpgarza/a2p2 | /portfolio/migrations/0001_initial.py | Python | py | 1,109 | no_license | # Generated by Django 2.0.5 on 2019-09-22 00:07
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Customer',
fields=[
... |
44f7d60d402c6b6e65467858fc00601717b33e54 | ad2a1d26124a8228b33a41c927d113c0470bca96 | pratyushsharma/Process-Schedule-simulator | /schedulers.py | Python | py | 2,851 | no_license | import bisect
class FCFS :
def __init__(self):
self.contextSwitch = 0
self.presentJob = 0
def schedule(self, ready, completed, responded, clock):
if len(ready) > 0:
nextJob = ready[0]
if nextJob != self.presentJob:
clock.tock(self.contextSwitch)
... |
2bd069beb4014e70bc4f0bd4324b7c59f5b9cd38 | f5f9bd9783b410f20b300b704ec2add002a1eb3a | naren-black/xray-sample-apps | /PythonLambda/lambda_function.py | Python | py | 853 | no_license | import boto3
import os
from datetime import datetime
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
import requests
# patch(['boto3'])
patch_all()
def handler(event, context):
s3 = boto3.client('s3')
subsegment = xray_recorder.begin_subsegment('S3Again')
# seg = xray_re... |
89e487d538b199670b7c0a151bda5aa2cca5b24d | e359c127edc944537cfb2a00234e9a60664df8a6 | pgbarletta/ttr | /bu/ac/1CH_check.py | Python | py | 9,719 | no_license | from pymol.cgo import *
from pymol import cmd
cmd.hide("lines")
cmd.show("cartoon")
CH_check = [
COLOR, 1, 1, 1,
LINEWIDTH, 1.0,
BEGIN, LINES,
# new facet 1
VERTEX, 10.256, 9.46, -17.668,
VERTEX, 11.386, -5.881, -18.773,
VERTEX, 10.256, 9.46, -17.668,
VERTEX, 12.783, 5.108, -16.464,
VERTEX, 11.386, -5.881... |
b66a2b26237ecae13e951f99a4b9ba405e1b2643 | 0f84e6bc70299f39dd71db5191460310572fca53 | hanxuel/scannet_primaldual_method | /origin_eval_scannet.py | Python | py | 23,232 | no_license | import os
import glob
import shutil
import argparse
import tempfile
import numpy as np
import tensorflow as tf
import plyfile
from skimage.measure import marching_cubes_lewiner
def mkdir_if_not_exists(path):
assert os.path.exists(os.path.dirname(path.rstrip("/")))
if not os.path.exists(path):
os.maked... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.