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 |
|---|---|---|---|---|---|---|---|---|
7e1fe2cdbd4d708b5d99d6d83c91294027ea0427 | 9b81f846e4f4e65a25766bdda84b78f562eca38a | saketkattu/Handwritting-to-Text-Converter | /text-convertor/text_recoginzer/data/emnist.py | Python | py | 7,356 | permissive | """
EMNIST dataset. Downloads from NIST website and saves as .npz file if not already present.
"""
from pathlib import Path
from typing import Sequence
import json
import os
import shutil
import zipfile
from torchvision import transforms
import h5py
import numpy as np
import toml
from text_recognizer.data.base_data_m... |
9d86a9367005675cdedfa2db177166a0f39424ae | 5e8c726d24d5437d7fefb3d3595588d5ed2ea8e7 | mahmoudafifi99/Classifiy-song- | /classify song/classification_Test.py | Python | py | 8,095 | no_license | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from Pre import *
from sklearn import metrics
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.preproc... |
633392737ce73f0a333aaad36d6768ab61927da2 | 884ef726a28461ff2d05bb0d3f7a85249aee1453 | VijayEluri/the-switchable-painting | /server/src/test/UploaderTestModule.py | Python | py | 2,893 | no_license | #!/usr/bin/env python
import unittest
from org.iproj.file.uploader import Uploader, WrongExtensionError, WrongMimetypeError, SizeLimitExceededError, NullRequestError
class DummyFileRequest:
def __init__(self, ext = "png", ct = "image/png"):
self.files = {"test": [{"filename" : "testimg." + ext, "body... |
407f9d165dd6f09df52fe2d360de0c400a796a3f | 29bebba135f3ea4745851c3042d7ae8ed3f8107b | studieren-ohne-grenzen/schlemmenohnegrenzen | /frontend/migrations/0019_auto_20170607_1942.py | Python | py | 826 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-07 17:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('frontend', '0018_auto_20170607_1124'),
]
operations = [
migrations.AlterFie... |
508a6eafe02bfeec57e1308fe99b292a42fac14c | 3783e1f62d424ac016c3c861d2c80da787ec8a34 | FoeinLove/civisml-extensions | /civismlext/test/test_preprocessing.py | Python | py | 27,996 | permissive | from __future__ import print_function
from __future__ import division
import pickle
import io
import warnings
import numpy as np
import pandas as pd
from numpy.testing import assert_almost_equal
from sklearn.exceptions import NotFittedError
from sklearn.utils.estimator_checks import (
check_transformer_data_not_a... |
0c25de0b20469625d9197d9481c04b091be1f019 | dc3ff209932fd9818a09660fabb726af8350192f | HelenBai2002Tong/Cesium | /Projects&Assignments/polysum.py | Python | py | 302 | no_license | import math
def polysum(n,s):
'''
:param n: the number of sides of the polygon
:param s: the length of each side
:return: the sum of the area and square of the perimeter of the regular polygon
'''
a=0.25*n*s**2/(math.tan(math.pi/n))
b=(n*s)**2
return round((a + b), 4) |
212b70c4c52790e0ea0ff3ffef761d0a117dfc4b | 81fa5e8567bac0c497cd3e2386ae380340ddb88f | bathepawan/chromium | /testing/merge_scripts/code_coverage/merge_results.py | Python | py | 6,561 | permissive | #!/usr/bin/python
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Merge results from code coverage swarming runs.
This script merges code coverage profiles from multiple shards. It also merges
the test ... |
64fd9735dca9730a6d2572639f82ab7207bcc7d5 | be4eef541e5b37a9b2ce3192f1d428910bf6328b | kobeydon/poddict | /poddict/pdblog/views.py | Python | py | 7,283 | no_license | from django.shortcuts import render, redirect, resolve_url, get_object_or_404, HttpResponseRedirect
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.core.mail import send_mail
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import Create... |
805c0f5f6e5c7c741a7a0e5afc979188975b12d8 | 64037ca225312b6db76ecfc352dccecf44a61bd8 | Mjusten/pythonElaborata | /dicionario.py | Python | py | 1,042 | no_license | lista = [1,4,"Batman"]
#declarar dicionário
#1
d = dict()
#2 ou
d= {}
#3 populando
d = {"cliente":"Alexandre", "seila":"Batman","texto":12,"outra":True}
arvore = {"a": {
"Alexandre": 12,
"André" : 14,
},
"b": {
"Batman": 16,
"Bruno": 18,
}
}
cliente = {
"12": {
"nome"... |
112d6e5f2f204e23bdc3830082b7edb715a73080 | 4fc7afb7ac70e1f3051ba22b3fdf8fe0766b914c | twu38/Calorie_Counter | /CalorieDictHandle.py | Python | py | 1,022 | no_license | def csv2dict():
"""turns the csvfile to a list of dictionaries."""
listOfdicts = list()
with open(CSVFILE,'r') as fin:
for line in fin:
line = line.strip()
if not line or line.startswith("#"):
continue
(food,unit,calUnit,calOunce,calHG) = line.... |
2f822a55441b6420039137d17d6eb29b02eb4770 | ec7a13670b4478707defa9de233ca0598f529418 | ChrisIossa/python-snapcast | /snapcast/control/stream.py | Python | py | 1,366 | permissive | """Snapcast stream."""
class Snapstream(object):
"""Represents a snapcast stream."""
def __init__(self, data):
"""Initialize."""
self.update(data)
self._callback_func = None
@property
def identifier(self):
"""Get stream id."""
return self._stream.get('id')
... |
8a2727f0620d58e5b4ce4d4e196166b630fec1a2 | 91b603ad5005ae9d62d661a059bf736164ca946f | crypdick/ray | /release/ray_release/tests/test_test.py | Python | py | 4,227 | permissive | import sys
import os
from unittest import mock
import pytest
from unittest.mock import patch
from ray_release.bazel import bazel_runfile
from ray_release.configs.global_config import (
init_global_config,
get_global_config,
)
from ray_release.test import (
Test,
_convert_env_list_to_dict,
DATAPLAN... |
998f2a18211a47417d886fad86b8addc2002984c | d7815a7a288d5fe56a9fe24ecaf5ba5acd9c8c4f | LiYan1988/kthOld_OFC | /numerical_analysis_backup/small-scale-multiobj/pareto/arch5_pod100/pareto9.py | Python | py | 2,063 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 4 15:15:10 2016
@author: li
optimize both throughput and connections
"""
#import sys
#sys.path.insert(0, '/home/li/Dropbox/KTH/numerical_analysis/ILPs')
import csv
from gurobipy import *
import numpy as np
from arch5_decomposition_new import Arch5_decompose
np.random... |
ff1ff8f5e89e14f2ec9beac5d45dd1035f73dc5e | e5f5b7dc76963c0021bfa7c333a6ce07ac500d3e | czielinski/pyamg | /pyamg/blackbox.py | Python | py | 11,308 | permissive | """Solve an arbitrary system"""
__docformat__ = "restructuredtext en"
import numpy as np
import scipy as sp
from scipy.sparse import isspmatrix_csr, isspmatrix_bsr, csr_matrix
from pyamg import smoothed_aggregation_solver
from pyamg.util.linalg import ishermitian, norm
__all__ = ['solve', 'solver', 'solver_configura... |
f6f6dbd7f836a6554b1d38c5a2e64471caeae3fc | 13e37aebb5610d2e3ed3bb1045b43e5996319552 | Ismail774403783/aws-sam-cli | /tests/integration/buildcmd/test_build_cmd.py | Python | py | 24,023 | permissive | import sys
import os
import logging
from unittest import skipIf
from pathlib import Path
from parameterized import parameterized
from subprocess import Popen, PIPE, TimeoutExpired
import pytest
from .build_integ_base import BuildIntegBase
from tests.testing_utils import IS_WINDOWS, RUNNING_ON_CI, CI_OVERRIDE
LOG = ... |
e8fce6b8bdf5d9896e762c61293398e529854b1c | 2cda807ac3ce6811eecafe344418a8c11bbc7040 | v2msLabs/ML1020-Course-Project | /src/extract_features.py | Python | py | 1,055 | no_license | import sys
from sklearn.externals import joblib
import time
from utils import extractFeatures
import glob
print(sys.argv)
print("Command : python extract_features.py input_data_path output_data_path [output_file_prefix]")
input_path = sys.argv[1]
output_path = sys.argv[2]
prefix = ""
if (len(sys.argv)>3):
prefix =... |
9b13f8eb31347c39c43a465f3e18000da606ec51 | 0bad35d9c2c5f22ab80a7553d403849438aa9fc3 | itsjw/python_exercise | /30-Days-of-Python-master/Day 5/day5_functions_end.py | Python | py | 1,624 | permissive | items = ["Mic", "Phone", 323.12, 3123.123, "Justin", "Bag", "Cliff Bars", 134]
str_items = []
num_items = []
for i in items:
if isinstance(i, float) or isinstance(i, int):
num_items.append(i)
elif isinstance(i, str):
str_items.append(i)
else:
pass
print(str_items)
print(num_item... |
f1e4cf1481239e56ac0e2716a697ddbcd902a136 | 39228f6d1c5de122979e69d173c470e01d80700b | ruher/pores4thought | /2D/preprocess/generate_inputs_tiff.py | Python | py | 2,221 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 2 12:31:48 2019
@author: ag4915
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 20 16:40:16 2019
@author: ag4915
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 15:26:43 2019
@author: ag4915
"""
import tifffile
import numpy as np
import argparse
import os
... |
3994606b41167551f5e1ff4a0745e858e1fdccf3 | b19bf534a054da217dced9510b2a2d7096b31395 | kimdon-ethz/Introduction-to-ML---msrl | /Jonas/Task1/task1b/submission/main.py | Python | py | 4,830 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "1.0.1"
__maintainer__ = "Jonas Lussi"
__email__ = "jlussi@ethz.ch"
"""Brief: Loads a csv File with input Vectors X and corresponding outputs y. Performs Feature transformation,
Ridge Regression with parameter optimization with Crossvalidation of the data. ... |
d96de90372ea69f820dc8d6a27b676882492c1e9 | 559240201ffce7f0db2efbab262de85c078aa7cc | GuyAgiv/PythonADT | /ADT/AVLTree.py | Python | py | 3,951 | no_license | from ADT.BinarySearchTree import *
class AVLTree(BinarySearchTree):
def __init__(self):
super(AVLTree,self).__init__()
def insert(self, value):
theNewNode = super(AVLTree, self).insert(value)
self._examineInsert(theNewNode)
def _examineInsert(self, theNewNode, path=[]):
i... |
792c013ef11af9e9e869f5efa6d1bf0e70dc658f | 9450da3c0cd9df61db2f972e215280e6ad6252cd | stevepinelli/intro-data-capstone-musclehub | /steve_pinelli_capstone_project/steve_pinelli_musclehub.py | Python | py | 13,243 | no_license |
# coding: utf-8
# # Capstone Project 1: MuscleHub AB Test
# ## Step 1: Get started with SQL
# Like most businesses, Janet keeps her data in a SQL database. Normally, you'd download the data from her database to a csv file, and then load it into a Jupyter Notebook using Pandas.
#
# For this project, you'll have to... |
3240b5fa19929da1a5db019a5b66e9ea6859c5b4 | e3a8b921d93de730b36dcd43044195aadaca6f8b | marianotepper/hough-anscombe | /houghvst/tests/test_phantom.py | Python | py | 13,707 | permissive | import matplotlib.pyplot as plt
import matplotlib.lines as plt_lines
import matplotlib.patches as plt_patches
import matplotlib.ticker as plt_tick
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
import seaborn.apionly as sns
from sklearn.linear_model import LinearRegression
from sklearn.metrics import ... |
cc86fd8be7ff7533d30211494e31c513397400b9 | 85b87f50a4a3cd7e13fb6715501549ec588ee5a6 | FrancoisTDrolet/lolbet | /leagueTests.py | Python | py | 1,119 | no_license | import unittest
import lolbet
import datetime
class TestNewResultInputStr(unittest.TestCase):
def setUp(self):
self.league = lolbet.League()
self.league.newResult("A","B",1,datetime.date(2014,9,11))
def testTeamsAddedToDictionary(self):
self.assertTrue(self.league.teamsDic... |
2832c232e3a2516996af988b2b5ac876eb0ee430 | 3888fbc02a9cd5cc574f2eafc2d4847fd914efb3 | titusz/sqrl | /setup.py | Python | py | 782 | permissive | try:
from setuptools import setup
except:
from disutils.core import setup
dependencies = ['docopt', 'ed25519', 'py-notify']
setup(
name='sqrl',
version='0.0.1',
description='Command line SQRL client',
url='http://gitbub.com/bushxnyc/sqrl',
author='Brian Pinkney',
author_email='bushxnyc... |
2460f19cc481c59e585812c0b1aa32eba049aa5a | dd13465161badb317e29cc9b2298c698f112364b | wqh872081365/wangqihui_website | /blog/urls.py | Python | py | 1,789 | no_license | from django.conf.urls import url, include, patterns
from . import views
from . import tests
# from django.contrib import admin
from rest_framework import routers
from rest_framework.urlpatterns import format_suffix_patterns
from . import rest_views
urlpatterns = patterns(
url(r'index/$', views.IndexView.as_view... |
128a25c972e3bb79e8edfb6f33bcff60f35bd3bd | 767877ba1ee4f0b3c5a21b8f818fd4b77b6d5631 | iremkapucuoglu/NDVI-NDWI | /NDVI-NDWI.py | Python | py | 5,552 | no_license | #!/usr/bin/env python
# coding: utf-8
# # Importing Libraries
# In[86]:
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
from skimage import io
from skimage import exposure
# Study area is selected as Burdur/Turkey to see the amount of lakes and the vegetation near the lakes in two ye... |
402b10da6485fca2b1445f42ff8b8cfd4c67fbba | 2ea84ec19759628ff54edaee7e4c4da3eeca5b84 | TiAmoY/learn | /venv/Scripts/pip3-script.py | Python | py | 414 | no_license | #!F:\myWorkSpace\python\python»ů´ˇ\venv\Scripts\python.exe -x
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])... |
96e9645162f260ed0ee46524c300a140d3abd330 | fbbf80683daf6edc27e6c023717d5870b9db6cbf | Onofri/ggpl | /2017-01-13/createLevel1.py | Python | py | 5,679 | no_license | from pyplasm import *
from larlib import *
import math
import csv
import fpformat
def stringToFloat(str):
l = str.split(',')
newList = []
for c in l:
elem = float(c) / 20.
newList.append(elem)
return newList
def structure(file_name):
interior = 0
with open(file_name, 'r') as ... |
90d82f30bb67ffdaa8344bce03a9d6bd7ceed573 | f031b6a6af279da08d7925b52775bfee31f62f05 | SeokLeeUS/Particle_filter | /VS2015_python_particle_filter_weight/VS2015_python_particle_filter_weight/VS2015_python_particle_filter_weight.py | Python | py | 3,600 | no_license | from math import *
import random
import sys
print(sys.version)
landmarks = [[20.0, 20.0], [80.0, 80.0], [20.0, 80.0], [80.0, 20.0]]
world_size = 100.0
class robot:
def __init__(self):
self.x = random.random()*world_size
self.y = random.random()*world_size
self.orientation = random.random()*2.0*pi
... |
6c88442f90debd76b08d656628d94f60643c9246 | 647e409b9a7daaf6586892ea0b55df8e0924710b | eayunstack/zaqar | /zaqar/tests/helpers.py | Python | py | 9,873 | permissive | # Copyright (c) 2013 Rackspace Hosting, Inc.
#
# 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 ... |
4c0d38fdc2933023fbc16ed611d7e5d88a745a4a | acc7f4b626e144d0a334d3280507184f36f30db7 | shreyhas/AttendanceProject | /Attendance_Management_Project/classes/migrations/0029_auto_20201204_2123.py | Python | py | 833 | no_license | # Generated by Django 3.1.3 on 2020-12-04 15:53
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('classes', '0028_auto_20201203_2131'),
]
operations = [
migrations.AddField(
model_name='classmodel',
... |
e7f3f9e780dd3da2977920ba470b1afb3c357154 | feed2eae476bb02aeb513adeb8e0d37b5cbd02a0 | hw233/ya | /script/pay/services/views/pay/wdj.py | Python | py | 2,159 | no_license | # -*- coding: utf-8 -*-
import json
def confirm_wdj_get_link_id(request):
return ''
def confirm_wdj(request, pay_channel={}):
content_str = request.POST.get('content', '{}')
signType = request.POST.get('signType', '')
sign = request.POST.get('sign', '')
# 在订单支付成功后会立即以POST 方式回调
pay_amount... |
8c9cbb05e02c6fb97ed2254845dcf76ba8e8a560 | f6bb0b53122df3718492be8b04ecf623ccd06d4c | Naveen7kumar7/DataStructure-Using-Python | /deletion at begin,end,pos in DLL.py | Python | py | 1,580 | no_license | class Node:
def __init__(self,data):
self.data = data
self.next = None
self.prev = None
class DLL:
def __init__(self):
self.head =None
def printlist(self):
if self.head is None:
print("linkedlist is empty")
else:
temp = se... |
585edf2f8f5d83fc9af40a129e98b7a0b04096fc | 5941b25dd384b7eb989b80a82277cd2ee5012fa1 | qyguo/genproductions | /python/ThirteenTeV/Hadronizer/Hadronizer_TuneCP1_13TeV_pTmaxMatch_1_pTmaxFudge_half_LHE_pythia8_cff.py | Python | py | 1,366 | no_license | import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
#from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import *
from Configuration.Generator.MCTunes2017.PythiaCP1Settings_cfi import *
from Configuration.Generator.PSweightsPythia.PythiaPSweightsSettings_... |
ffa140a6aa62fb3e1c9c24f3574de2ceba1c6461 | 5b5a4c28021cec46f54616dda1d054b70cf759b7 | hsin090811/ctf | /nctu-secure-programming-2020-fall/hwa-pwn/1-survey/distribute/share/exploit.py | Python | py | 1,789 | no_license | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from pwn import *
context.log_level = 'debug'
elf = ELF('./survey')
# Byte sequence alias
A8 = 8 * b'A'
def main():
'''
1. Leak stack canary via fmt attack
2. Return to main()'s 2nd read() again
- main()'s 2nd read: 0x5558b3315292
- main()'s... |
a5be687eb8993d43db455ae2254a690e1c0a1b56 | a76e20e376d75d3e05c759188e724f9f202b0ee4 | yijixiuxin/ccxt | /python/ccxt/async_support/probit.py | Python | py | 61,917 | permissive | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import A... |
466e4d06e13497b509e8d04225e8b9dcdc8408d4 | bedcfe82bf6c82a0d205f4e8c0ba5e150fff0480 | awgeezrick/CS109a_finalproject_group20 | /spotify_utils.py | Python | py | 4,722 | no_license | # spotify_utils
# Author - Mark McDonald - 2019
# Includes some basic utilities for Spotify db and api handling
import os
import pickle
from tqdm import tqdm_notebook as tqdm
class List_Generator():
"""
Create batch generator for a list that you want to interate over
"""
def __init__(self, mainlist, ... |
0fc0e98bc900715eaf41cf71837b233620ca23a9 | bfbc9808ccf9c6c6d7bb3fc4070ed29391e57a6e | zdravkob98/Programming-Basics-with-Python-March-2020 | /Programing Basics March2020/Nested Loops - Lab/06. Building.py | Python | py | 292 | no_license | floor = int(input())
rooms = int(input())
for f in range(floor, 0, -1):
for r in range(rooms):
if f == floor:
print(f'L{f}{r}', end=' ')
elif f % 2 == 0:
print(f'O{f}{r}', end=' ')
else:
print(f'A{f}{r}', end=' ')
print()
|
280706aa09af72a1e50c5dbbb7a34e4a8c0905bc | 2378fc8098bcc2e9d78bbfd40fee95a9dd33b43f | onMyWayTo/csv2lua | /gl.py | Python | py | 481 | permissive | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
keyLine = 1 # csv file keys line
keysArr = []
typeLine = 2 # csv file types line - string bool int
typesArr = []
defineLine = 3 # >= 3
typeInt = "int"
typeBool = "bool"
typeStr = "string"
# inputDir = "../../dpsg/ga... |
3b1d0c47f4a4d0c6206146e33653769b3e83dd03 | 3cd996183f151e0afa438581404a9ffdc46316ef | pnrobinson/sundry_scripts | /liftover.py | Python | py | 1,335 | permissive | import tempfile
import sys
import os
LIFTOVER='/home/peter/IdeaProjects/svann/scripts/liftOver'
CHAIN='/home/peter/IdeaProjects/svann/scripts/hg19ToHg38.over.chain.gz'
if len (sys.argv) != 2:
raise ValueError("Usage python liftover chr10:127460915-127466819")
posstring = sys.argv[1]
fields = posstring.strip().... |
d4a08c1a6515511c164756e20c41b67559a1e385 | a05c5c6247dd39fdb58326d8de11aff86d808125 | guti7/Data-Structures | /source/bases.py | Python | py | 2,363 | no_license | #!python
import string
ALPHA = "0123456789abcdefghijklmnopqrstuv"
def decode(str_num, base):
"""
Decode given number from given base to base 10.
str_num -- string representation of number in given base
base -- base of given number
"""
assert 2 <= base <= 36
negative = False
result =... |
e99e45f0cabf8b9fade3d1f48caac4ca50492595 | f992eb3bf097440edbd32fcbd9b323632b643a5e | sergpolly/FluUtils | /RNA_SNP_association/flu_module_old.py | Python | py | 24,255 | permissive | import sys
# import re
# import os
# import string
import random as rnd
import numpy as np
import pandas as pd
import subprocess as sub
import matplotlib.pyplot as plt
from Bio import SeqIO
from Bio import SeqRecord
# import Bio
import copy
import re
import scipy.sparse as sparse
import matplotlib as mpl
mpl.rcParam... |
672399ce7b0d86b8aaf25f4ea218a1ee5f062db3 | 138c1cc64c0211aca2626b13c5802f2bf49b7ac2 | ioomoon/newsportal | /newsportal/urls.py | Python | py | 415 | no_license | from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('pages/', include('django.contrib.flatpages.urls')),
path('news/', include('news.urls')), # все адреса из приложения news подключаем к urls проекта
path('accounts/', include('al... |
5d1d675fe500610c6bcc2dcdd8dfa3b71a0d6f10 | 8237fa9db8fd90746e5351505a3f79638f361222 | yashagrawal300/python-programs | /Hackerearth/Back_to_school.py | Python | py | 875 | no_license | '''
In our school days, all of us have enjoyed the Games period. Raghav loves to play cricket and is Captain of his team. He always wanted to win all cricket matches. But only one last Games period is left in school now. After that he will pass out from school.
So, this match is very important to him. He does not want... |
df71781c5fb52c97ca0b7ac79a6aa13942046a6c | edd940c9afcd35fc522274b53a2de436c8fc7dd6 | NonvolatileMemory/gluon-nlp | /scripts/bert/bert_qa_dataset.py | Python | py | 20,056 | permissive | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and DMLC.
#
# 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 req... |
92efc220d35f4eefaf3aac51a32da3f7b00c60bf | 4011292970f27c2d94fccb099d63317cd6577478 | MasterAlish/Students-Home | /cooler/admin.py | Python | py | 532 | no_license | from django.contrib.admin import site
from django.contrib.admin.options import ModelAdmin
from cooler.models import CoolSnippet, Puzzle, ExerciseTestCase, ExerciseSubmit, Exercise
class CoolSnippetAdmin(ModelAdmin):
list_display = ['datetime', 'task', 'user', 'username', ]
class PuzzleAdmin(ModelAdmin):
li... |
4c15265d4274077d878682b2260263d8997cca9a | 79328b32d9d426be410af2ee690fe571fbc77443 | yurig93/oop_ex3 | /src/main.py | Python | py | 3,069 | no_license | from DiGraph import DiGraph
from GraphAlgo import GraphAlgo
def check():
"""
Graph: |V|=4 , |E|=5
{0: 0: |edges out| 1 |edges in| 1, 1: 1: |edges out| 3 |edges in| 1, 2: 2: |edges out| 1 |edges in| 1, 3: 3: |edges out| 0 |edges in| 2}
{0: 1}
{0: 1.1, 2: 1.3, 3: 10}
(3.4, [0, 1, 2, 3])
[[0,... |
e603ba36c37f1e5dddcc38d0b65990481de1f32a | cbe8588d748c66fd088b83e13c00aa1d3c1afb95 | ocadotechnology/bbq | /src/slo/backup_quality/quality_query_specification.py | Python | py | 2,488 | permissive | from src.commons.config.configuration import configuration
from src.commons.table_reference import TableReference
class QualityQuerySpecification(object):
@staticmethod
def query_string():
projects_to_skip = tuple(configuration.projects_to_skip)
return "SELECT * FROM [{}:SLI_backup_quality_vi... |
49743b17cc440243dd6210ec5c2da4b91053fc23 | 330644db6252d04a33eb548c5d7ac0f4e6d3dac9 | AntoineGuillot2/NGSA_project | /lib/build_graph.py | Python | py | 336 | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 12 20:52:23 2018
@author: antoine
"""
import numpy as np
def build_graph(sim_matrix):
random_mat=np.random.uniform(size=sim_matrix.shape)
random_mat=np.tril(random_mat)+np.transpose(np.tril(random_mat))
return (1-sim_matrix <= random_ma... |
05c3370dc06605c0f8c097ae5c1a2b94e7209c0c | 6d04f7233d11369a5fc052b7bf8b489d39cc09f3 | vishjsd/Test1 | /TEST1/asgi.py | Python | py | 387 | no_license | """
ASGI config for TEST1 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.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTING... |
11e632ed4ec0844a0435100c17872ff6c32b6513 | 3f68a877b9440233252fe36d198f54ba8ce9488a | manghat/coursera-algo-toolbox | /week5_dynamic_programming1/2_primitive_calculator/primitive_calculator.py | Python | py | 770 | no_license | # Uses python3
import sys
def optimal_sequence(n):
sequence = []
a = [0]*(n+1)
for each in range(1, len(a)):
a[each] = a[each-1] + 1
if each % 2 == 0:
a[each] = min(1+a[each//2], a[each])
if each % 3 == 0:
a[each] = min(1+a[each//3], a[each])
... |
0c30efa8359386a92519ad61277651b3b2a1385a | 499f9a7910e21f268fe114be3d8d44c97df0719a | jpcvandam/ftm_webapp | /migrations/0002_delete_waypoint.py | Python | py | 306 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ftm', '0001_initial'),
]
operations = [
migrations.DeleteModel(
name='Waypoint',
),
]
|
719101b6b31ffbd236c7d2f38fb697a88755df0c | cb18c3269d1456a62605ad6c6e5d7a6478c41652 | usmanager/microservices | /sock-shop/queue-master/test/util/Dredd.py | Python | py | 1,896 | permissive | # MIT License
#
# Copyright (c) 2020 manager
#
# 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, merge... |
9fb14d5f9470464258bece026457b56253347b1b | 3a3eb721bb33f0453e6b7abd233a37ec2f5f846b | kongzhiyou/utils | /video_to_image.py | Python | py | 1,590 | no_license | import cv2
import glob
import os
root_path = r'/Users/peter/data/wljr/test3.mp4'
save_path = r'/Users/peter/data/wljr'
video_list = glob.glob(root_path)
'''
视频抽帧
'''
def vedio_switch_to_image():
i = 90
for vedio_path in video_list:
cap = cv2.VideoCapture(vedio_path)
print(cap.read())
... |
42eb3bcf4af99bec5771351529968c1417bd6c05 | f3978fdc9b228fad9ac0b9dc1f9959dc1e574557 | thellamalama/my-first-blog | /blog/views.py | Python | py | 302 | no_license | from django.shortcuts import render
from django.utils import timezone
from .models import Post
def post_list(request):
posts = Post.objects.filter(
published_date__lte=timezone.now()
).order_by('published_date')
return render(request, 'blog/post_list.html', {'posts': posts})
|
a53f5e6129a3087fc1cc8491de8ef602730c4081 | c14acf37c643d24ffffa8ec0fe9d43d2cd697b3b | amsler/skeinforge | /fabmetheus_utilities/geometry/geometry_utilities/evaluate_enumerables/string_attribute.py | Python | py | 4,130 | no_license | """
String object attributes.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities import euclidean
__author__ = 'Enrique Per... |
9435c67fc2cab36ec94d47a3d401a94b5eae37c8 | 5c5111e383d370f977a78430409dcc12300704cf | sileht/integrations-core | /strimzi/tests/test_e2e.py | Python | py | 1,187 | permissive | # (C) Datadog, Inc. 2023-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.dev.utils import get_metadata_metrics
from datadog_checks.strimzi import StrimziCheck
from tests.common import CLUSTER_OPERATOR_METRICS, FLAKY_E2E_METRICS, TOPIC_OPERATOR... |
a0f6abeaac4af4d3b57babfd69d6807c43dc6636 | 8f8bd128007f2b8231b455c08f95f1459837eebe | gallev898/image_captioning | /sentence_analysis/projector_parser.py | Python | py | 2,064 | no_license | import torch
import os
import json
from collections import Counter
#sec: settings
ByModel = True
ByTrain = False
model_name = 'train_show_and_tell_dotproduct'
model_tar_file = 'NEW_BEST_checkpoint_coco_5_cap_per_img_5_min_word_freq.pth.tar'
path = '/Users/gallevshalev/Desktop/trained_models/{}/{}'.format(model_name, ... |
92577f153c7f6594524aaa116e043a4d856243af | b544b41dd3e04f7ba563c7aa271fd54d87f3a653 | chimbersaw/web-dev-2021 | /src/test/test_integrate.py | Python | py | 3,899 | no_license | from fastapi import HTTPException
from fastapi.testclient import TestClient
import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from src.main.app import app
from src.main.db.database import Base, get_database
from src.main.db.models import UserDB
from src.main.models.messenger im... |
8d88c90e4c29dac32f6b13b4a2e8c7d13b134962 | 43747cabc0132baaebf0e3ac498c9e6c9d0670b6 | joseaugusto20/academia-programador | /python/marceneiro.py | Python | py | 1,197 | no_license | # -*- coding: utf-8 -*-
# Programa Python otimiza o trabalho do Marceneiro, uma vez definido o tamanho da peça (pedaço) o
# programa calculas quantas peças dentro uma metragem maior (taboas). Dessa forma o Marceiro
# pode escolher qual a melhor metragem de taboa.
#
# Acesse e execute esse código Python em: http://pyth... |
5390aec24b62bb4f5bb553d538ef985f5f21a923 | 987c8f66d307d40762ac768e68df307c2d88a791 | kgz77/newBlog | /codewithstein/blog/migrations/0002_comment.py | Python | py | 938 | no_license | # Generated by Django 3.2 on 2021-04-29 10:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Comment',
fiel... |
42a8ba3eb6c26684abab797867278bb482355752 | 20e333553c1f2e4787bf36d5ec5f6e97561f69ac | J3rryPie/Django-Project | /projects/migrations/0008_auto_20201212_1638.py | Python | py | 740 | no_license | # Generated by Django 2.1.5 on 2020-12-12 11:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0007_auto_20201212_1624'),
]
operations = [
migrations.RenameField(
model_name='pro... |
062a42626b5ef61a33aafa0cf9a2c833b0a95d18 | 3d296c282624e99341a2195f5936a97982d14517 | ThreeFDDI/ATBS | /ATBS-17.py | Python | py | 1,097 | no_license | #!/usr/local/bin/python3
# Chapter 17 – Manipulating Images
# ATBS-17.py
from PIL import ImageColor, Image
print(ImageColor.getcolor('red', 'RGBA'))
catIm = Image.open('ATBS/ATBS-17_zophie.png')
print()
print(catIm)
print(type(catIm))
print(catIm.size)
print(catIm.width)
print(catIm.height)
print(catIm.filename)... |
c8cba010d7f0b9a479cee3f866b3ab4a09548342 | 7700c7ac8ab5ea171a46db372092c0e342e911d6 | stefantquach/ComputerVision_Algorithms | /pset5/code/prob1.py | Python | py | 4,842 | no_license | ## Default modules imported. Import more if you need to.
### Problem designed by Abby Stylianou
import numpy as np
from scipy.signal import convolve2d as conv2
def get_cluster_centers(im,num_clusters):
# Implement a method that returns an initial grid of cluster centers. You should first
# create a grid of ev... |
0e90e9f7500f6c8c68d22d7d95a7a09a56f3f623 | 3a7117e0ad8d6c5fba1158a438bdbb2d0c3b2899 | preed/quickrelease | /quickrelease/step.py | Python | py | 12,237 | permissive | # ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
r"""
The base class for QuickRelease steps, along with error reporting classes,
custom subclasses of steps, and classes to run the individual parts of the
steps.
L{Step}s are usually searched for in the C{quickrelease/steps} di... |
8e6c685b6821fbb3887430c40df1f6978ba45d80 | 1fba9a8bc5e41d3da0177645156c0f86f2400986 | wihl/cs282-f17-xuefeng-yi-david | /code/kernel_based/lstm_autoencoder.py | Python | py | 3,785 | no_license | import numpy as np
from keras.layers import Input, LSTM, RepeatVector, Flatten
from keras.models import Model
from keras.optimizers import Adam
from keras import regularizers
from keras.callbacks import TensorBoard
from keras.callbacks import EarlyStopping
from sklearn.model_selection import train_test_split
from time ... |
10b95fbd08a232fd47d25864d1c8118f2aba7945 | cd3c3092f627cb59fe04e1c8445843a30f8a1b8e | kdschlosser/pyatv | /tests/airplay/test_airplay_auth.py | Python | py | 2,823 | permissive | """AirPlay device authentication tests with fake device."""
import binascii
from aiohttp import ClientSession
from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop
from pyatv.const import Protocol
from pyatv.airplay import srp
from pyatv.airplay.auth import DeviceAuthenticator, AuthenticationVerifier
fro... |
c81e8fed507c01b7d132918deab6e1572a3281e8 | 6f33164f73921064ed45510314a9f065248594c3 | paulmartini/baltools | /bin/runbalfinder_hp.py | Python | py | 9,316 | permissive | #!/usr/bin/env python
'''
Generate BAL catalogs from DESI healpix data for a specific data release. One
catalog is generated per healpix. The catalogs are put in a directory
structure that matches the structure of the data release.
Use the separate script buildbalcat.py to create a BAL catalog for a
corresponding ... |
8e8dc3270af5f4dbe94b77c24f773ed4cd6d71eb | 55e766add84089a2a8865007f3b860ea47f0646e | Qiulin-Wang/py-tools | /join_files.py | Python | py | 4,154 | no_license | # -*- coding: utf-8 -*-
# Copyright © 2018 by IBPort. All rights reserved.
# @Author: Neal Wong
# @Email: ibprnd@gmail.com
import os
import sys
import argparse
parser = argparse.ArgumentParser(description='Join two files by column.')
parser.add_argument('--i1', help='Input file 1.')
parser.add_argument('... |
448b2c36d6dde32fc425f87e0db735f212a1ae1d | 2c46560a2db42278e60ea10b44f9f5b5612aab43 | imranjeetsingh/E-commerce-site | /ecommerce/src/orders/models.py | Python | py | 3,381 | no_license | from math import fsum
from django.db import models
from django.db.models.signals import pre_save, post_save
from ecommerce.utils import unique_order_id_generator
from carts.models import Cart
from billing.models import BillingProfile
from addresses.models import Address
# Create your models here.
ORDER_STATUS_CHOICES... |
f5642b55f68cc70b074305f84be4720698095a2e | 26a5134ca4544e1b213b18ef60d2a978e8c36286 | mahandas/Biometric_Access_via_Veins | /Processing_Algorithms/Matching_Algo/matching_brute_orb.py | Python | py | 685 | no_license | import numpy as np
import cv2
import matplotlib.pyplot as plt
img1 = cv2.imread('test.jpg',0) # queryImage
img2 = cv2.imread('temp.jpg',0) # trainImage
# Initiate ORB detector
orb = cv2.ORB_create()
# find the keypoints and descriptors with ORB
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.dete... |
619ff24b46b157f7f319659437bac1f4d8f9b0fb | 39022f1db3d2833178eed214d6e7f91c851a8518 | Adniel/hejasverige.megabank | /hejasverige/megabank/viewlets.py | Python | py | 2,924 | no_license | # -*- coding: utf-8 -*-
from plone import api
import logging
from requests.exceptions import ConnectionError
from requests.exceptions import Timeout
from hejasverige.megabank.bank import Bank
from five import grok
from zope.interface import Interface
from hejasverige.megabank.settings import Settings
import urllib
# ... |
ee5f977ac945bb332f5cf92268bf52e88fd6cf27 | 7a73112cddd8451871fb7f19037a9034f0157d3f | NIUaard/DiWakeCyl | /MakeWake4Eleg.py | Python | py | 2,849 | no_license | import sys
# argument are inner radius, outer radius, epsilon, Nmodes, zmax
from pydefault import *
from DWFA_cyl_func_Ng import *
import os
print(sys.argv)
# structure parameters:
# becareful Ng switch convention wrt Gai (a>b in Ng!!!)
b = float(sys.argv[1])
a = float(sys.argv[2])
epsilon= float(... |
7083e0cb325dde3fd72aad842c0e96191c689ec1 | 9d713885c0438aa2ce866d4412618ec417cd7e19 | wanjiku-carol/codeapp | /services/users/project/tests/test_users.py | Python | py | 6,895 | no_license | import json
import unittest
from project import db
from project.tests.base import BaseTestCase
from project.api.models import User
def add_user(username, email):
user = User(username=username, email=email)
db.session.add(user)
db.session.commit()
return user
class TestUserService(BaseTestCase):
... |
03f2b01499b1c14c86e55315d71cf2dce6259ef4 | 8e7d2ecbf23d076dcf6fa08476b8930423cf6e93 | fcavalca/Glovebox | /Glovebox_streamlit.py | Python | py | 4,255 | no_license | # -*- coding: utf-8 -*-
"""
Created on 03/10/2021
@author: Filippo Cavalca
"""
import plotly.graph_objects as go
from plotly.subplots import make_subplots
#import plotly.express as px
#import numpy as np
import pandas as pd
import streamlit as st
st.title("Glovebox data plotter")
file = st.sidebar.f... |
9651387abb51b741960729d83cc67d122ab80d00 | 2b524e3f5e7b08f2ee8e3d33cba46dd848adcd94 | peppythegod/ToontownOnline | /toontown/toon/DistributedNPCFisherman.py | Python | py | 6,085 | no_license | from pandac.PandaModules import *
from DistributedNPCToonBase import *
from direct.gui.DirectGui import *
from pandac.PandaModules import *
import NPCToons
from toontown.toonbase import TTLocalizer
from toontown.fishing import FishSellGUI
from direct.task.Task import Task
class DistributedNPCFisherman(DistributedNPCT... |
e8e7b8aa4be0eadffc46bdc5056eb24486f26cb4 | ab9b0f2ae9f43e0f3d5fe04fa625296203a20fe1 | mark-antonov/Django_tutorial | /polls/models.py | Python | py | 846 | no_license | import datetime
from django.contrib import admin
from django.db import models
from django.utils import timezone
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return se... |
dd4d2e7c83950c9f3082c4678b06ec004a303f4e | aee695395716d7b8ff4013bebffdf03e8ef5fd63 | vas3k/vas3k.club | /users/views/intro.py | Python | py | 1,482 | permissive | from django.shortcuts import redirect, render
from django_q.tasks import async_task
from authn.decorators.auth import require_auth
from notifications.telegram.users import notify_profile_needs_review
from posts.models.post import Post
from users.forms.intro import UserIntroForm
from users.models.geo import Geo
from us... |
ca2751a7583662ee2cb66f2d528d94bdeb714db3 | e14a5e4b226b5846073a16a6525ba891d38a0d7f | cecilecaillol/Skimming_STXS | /SMH_em_2017/prepare_run.py | Python | py | 11,176 | no_license | import os
if __name__ == "__main__":
# place="/hdfs/store/user/tmitchel/SMHTT_2017_legacy_data_v3/"
# datatype="data"
# name=[
#"data_MuonEG_Run2017B-31Mar2018","DataB","0",
#"data_MuonEG_Run2017C-31Mar2018","DataC","0",
#"data_MuonEG_Run2017D-31Mar2018","DataD","0",
#"data_MuonEG_Run2017E-31Mar2018","DataE",... |
580027f2840593a20c0cbf96cb41e6d0c19fea81 | 431c9bd4aa3de4ee45f2d24f60dee6677ca991fa | d-cent/HelsinkiActivityStream | /tests/data_server.py | Python | py | 1,090 | permissive | # Copyright (c) 2015 ThoughtWorks
#
# See the file LICENSE for copying permission.
import http.server
import multiprocessing
import os
import unittest
TEST_FIXTURE_SERVER_PORT = 5000
class TestFixtureRequestHandler(http.server.SimpleHTTPRequestHandler):
def __init__(self, request, client_address, server):
... |
71f0435e34aa6b2953f818d3839a671552bb7e35 | 3a42a896dc908c4c68600222f0820c7e24c1f6a2 | jacoposala29/ARGO_code_JS | /Codes_pipeline/implementations/plot_sample.py | Python | py | 1,209 | no_license | import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pickle as pkl
NULL = object()
def plot_2d(preds, shape, mask=NULL, clim=2, cbar=True):
bounds_x1 = (-8, +8)
bounds_x2 = (-2, +20)
minima, maxima = -clim, +clim
norm = mpl.c... |
68cf17925cf2d626bafe4ea91f650415da058f3e | 3763530b3bcec192cef727218df6246fb0586e0d | autodesk-cloud/ochonetes | /images/portal/resources/toolset/setup.py | Python | py | 1,499 | permissive | #
# Copyright (c) 2015 Autodesk Inc.
# 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 applicable l... |
c9428d402031bb5199d20b8f0dde5dd8b04b0bff | d5b30200295ea7c5413e8567410d3af5100f7283 | FryeGao/python_code_test | /summary02.py | Python | py | 2,522 | no_license | """
1.如何拆分含有多种分隔符的字符串
2.判断字符串a是否以字符串b开头或者结尾
3.如何调整字符串中文本的格式
4.如何将多个小字符串拼接成一个大字符串
5.如何对字符串进行左、右、居中对齐
6.如何去掉字符串中不需要的字符1
"""
# 1 s = 'ab;cd|efg|hi,jkl|mn\top' ==》 'abcdefghijkmntop'
# 解决方法1:连续使用str.split()方法,每次处理一种分隔符号
# split后会返回一个list ,再对结果进行循环遍历和切割,会返回一个二维列表,这样维度会很大
# 所以可以考虑先新建一个空列表,然后使用extend函数进行拼接,或者使用su... |
b606065a9c838816bd96123a03f152792dbf07cc | b2f8037cc186f35cd06fb699dc82eb180417fe75 | felip711/DjangoFRI | /proyectosenv/bin/django-admin.py | Python | py | 683 | no_license | #!/home/felipe/proyectos/proyectosenv/bin/python
# When the django-admin.py deprecation ends, remove this script.
import warnings
from django.core import management
try:
from django.utils.deprecation import RemovedInDjango40Warning
except ImportError:
raise ImportError(
'django-admin.py was deprecated... |
6cfaa18e664b88d53a30dbaf28c3d5bcef457f2d | b172348c42ef786b8f33d0226dbca4b8ead3ebfc | t880216t/move | /Demo/Test_airMode.py | Python | py | 3,684 | no_license | # encoding:utf-8
__author__ = "jian.chen"
"""
/*****************************************************************************/
* Filename:
* Test_airMode.py
* ---------
* Summary:
* 切换手机飞行模式手环重连成功
* ---------
* Preconditions:
* 手机与手环已连接
* ---------
* Setp Actions:
* 1.进去APK,进入Watch界... |
490ae7c9f3c444d557a5a0a4cbd73c32b6a5e792 | 27702369d8d5dcb29c4af00be2c9f0f84155073d | carlosag1220/Django-Learning | /Proyecto1/Proyecto1/settings.py | Python | py | 3,114 | no_license | """
Django settings for Proyecto1 project.
Generated by 'django-admin startproject' using Django 3.0.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
... |
90ddd8306de0e9e3dc4ab6675350cb3d120c9e76 | 3d4593dbeb77d3e83f9beacdadc9336bf57e9334 | natalymr/gcm | /code2seq_dataset_tests/many_to_one.py | Python | py | 3,129 | no_license | from pathlib import Path
from typing import List
import unittest
from code2seq_dataset.global_vars import padded_path, Message, Code2SeqPath
class DatasetManyToOneLine:
def __init__(self, commit_message: str, paths: List[str] = None):
self.commit_message: Message = Message(commit_message)
self.fu... |
75c32d5e9ec7ecf1acc677e507e46a374e2de444 | 8c4c7a16a24821378bdb4a0964c5de38a4092d69 | emblem/bb | /movie_writer.py | Python | py | 1,631 | no_license | import subprocess
import pyglet
# create a figure window that is the exact size of the image
# 400x500 pixels in my case
# don't draw any axis stuff ... thanks to @Joe Kington for this trick
# http://stackoverflow.com/questions/14908576/how-to-remove-frame-from-matplotlib-pyplot-figure-vs-matplotlib-figure-frame
def ... |
5c09c5a10fdde3e955189a2fbce0507e64f2a4a2 | fa14e63563259c3bfaccbdb0d6ccf884f8a1550d | coolsnake/JupyterNotebook | /new_algs/Graph+algorithms/Dijkstra's+algorithm/DijkstraAlgorithmH.py | Python | py | 2,377 | permissive | from graph_creationF import *
from heapq import *
from time import *
class DijkstraAlgorithmH(object):
def __init__(self, init_node):
self.initNode = init_node
self.time = ''
self.path = ''
# param - a Node object
def get_path(self, last_node):
s = [last_node.getName()]
while not last_node.prev is No... |
9500333d96ecce3696abba99891aca8268a1edee | 2acc3385cec219182537f736753057500eb2f03a | brightgems/pkdata | /xunfei-ctr-prediction/src/tfutils.py | Python | py | 12,896 | no_license | # coding: utf-8
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import pickle as pkl
import numpy as np
import tensorflow as tf
import pandas as pd
from scipy.sparse import coo_matrix
from .config import *
import time
#---------------------------------------... |
7ae3c6ca51b3cb677f5e49cf62e2dc89b3630d52 | 58964f8058d0e515a308bb9b8b81ab1b38b0e856 | ephraimrothschild/Machine-Learning | /Perceptron_USPS_OVA.py | Python | py | 6,939 | no_license | __author__ = 'Ephraim'
import numpy as np
import io
import random
import itertools
from operator import itemgetter
# The data was taken from the Zip Code data at:
# http://statweb.stanford.edu/~tibs/ElemStatLearn/data.html
class Perceptron:
dim = 256
def __init__(self, number_to_classify):
self.nu... |
77508cafc39c2be22cb8d5bd81313e9bffde1c35 | 78e0fa3362c69e0c18d59ccb66f5d5749e6211b6 | opensafely/pincer-measures | /analysis/co_prescribing_variables.py | Python | py | 7,411 | permissive | from cohortextractor import patients
def create_co_prescribing_variables(codelist_a, codelist_b, name_a, name_b):
vars = {
f"{name_a}": (
patients.with_these_medications(
codelist=codelist_a,
find_last_match_in_period=True,
returning="binary_flag... |
ac517b2597111dae1f7d00cad750f18802d713f8 | 338ca7e1f3d41015dd88f3cc17a5ef5f909049ce | mmansell7/cms-python-dev | /cmspythondev/cmspythondev.py | Python | py | 451 | permissive | """
Main python file for the cms-python-dev example
"""
#import statements go here
def mean(num_lst):
"""
Calculates the mean of a list of numbers
Parameters
----------
num_lst : list of int or float
List of numbers to calculate the average of
Returns
----------
float of the ave... |
c9e97b81fae092f30e1cd672d7a59618f47f30e4 | 66d92316fabe0b12cded5a93850623120bd17fff | yupasik/python_training | /test/test_add_group.py | Python | py | 556 | permissive | # -*- coding: utf-8 -*-
from model.group import Group
def test_add_group(app, db, json_groups, check_ui):
group = json_groups
old_groups = db.get_group_list()
app.group.create(group)
# assert len(old_groups) + 1 == app.group.count() # hashing
new_groups = db.get_group_list()
old_groups.append(... |
89ec3038ded015c68001de981bd9cf1bba6cc46f | 20f674d4d5b541d64b123d736b21e586c78aeb98 | frju365/hll_rcon_tool | /rcon/map_recorder.py | Python | py | 3,022 | permissive | import time
from datetime import datetime, timedelta
import logging
from threading import Thread
import redis
from rcon.discord import send_to_discord_audit, dict_to_discord
from rcon.extended_commands import Rcon, CommandFailedError
from rcon.utils import (
categorize_maps,
numbered_maps,
FixedLenList,
... |
7a4cffc91e734b11808dd8eca451a63a52d84542 | b9d0e35582860edac9ae08015dfe7808fd4d3aa0 | XFPlus/tvm | /python/tvm/driver/tvmc/autotuner.py | Python | py | 29,924 | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
9b2666f525336f8fe25c00283876d260a435a714 | c1d56ddd538091895ef18da7708764c5e1181ed4 | trajepl/trajectory-synthesis | /code-original/opt.py | Python | py | 4,573 | no_license | import baseline1 as rg
import baseline2 as ip
import features
import random
import math
def Sim(tra_f1, tra_f2):
a = sum([tra_f1[i] * tra_f2[i] for i in range(len(tra_f1))])
b = math.sqrt(sum([x ** 2 for x in tra_f1]))
c = math.sqrt(sum([y ** 2 for y in tra_f2]))
if b != 0 and c != 0:
return a... |
562b89bc7f0f34bd34b7d26a260addb1385be54f | 44f3b2121b2840c1b77fd0faebe7d180bad1932e | matheusxmendes/LMS | /LMS/settings.py | Python | py | 3,402 | permissive | """
Django settings for LMS project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
# ... |
7bfd475249def06ba163dd952269d2c78fcbc1ad | bbdac8a2c9e367ffdd4d9508ec11a336ec65edd1 | tainanboy/leetcode | /sorting/sort.py | Python | py | 1,736 | no_license | import sys
import os.path
import math
def insertion_sort(input_list):
A = input_list[:]
l = len(A)
for j in range(1,l):
key = A[j]
i = j-1
while(i>=0 and A[i]>key):
A[i+1] = A[i]
i = i-1
A[i+1] = key
return A
def merge_sort(input_list):
A = i... |
be3105fe9346243ca53b0abeb5569523e3449cb6 | d618e4f26c8b0dcc1e025a14ed75a9853924f929 | jtlai0921/PB1712-Python-Web- | /CHT/chapter02/function.py/tcp_client.py | Python | py | 395 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket #socket模組
HOST='127.0.0.1'
PORT=3434
s= socket.socket(socket.AF_INET,socket.SOCK_STREAM) #AF_INET說明使用
s.connect((HOST, PORT))
print "Connect %s:%d OK" % (HOST, PORT)
data = s.recv(1024) #接收資料,本次接收資料的最大長度為1024
print "Received: ", data
s.close() ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.