hexsha
stringlengths 40
40
| size
int64 5
2.06M
| ext
stringclasses 11
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 3
251
| max_stars_repo_name
stringlengths 4
130
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
251
| max_issues_repo_name
stringlengths 4
130
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
int64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
251
| max_forks_repo_name
stringlengths 4
130
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 1
1.05M
| avg_line_length
float64 1
1.02M
| max_line_length
int64 3
1.04M
| alphanum_fraction
float64 0
1
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1983c2bf22bdcb42a662ebdbf2a359de7f422d6f
| 444
|
py
|
Python
|
accelerator/migrations/023_alter_topics_field_office_hours.py
|
masschallenge/django-accelerator
|
8af898b574be3b8335edc8961924d1c6fa8b5fd5
|
[
"MIT"
] | 6
|
2017-06-14T19:34:01.000Z
|
2020-03-08T07:16:59.000Z
|
accelerator/migrations/023_alter_topics_field_office_hours.py
|
masschallenge/django-accelerator
|
8af898b574be3b8335edc8961924d1c6fa8b5fd5
|
[
"MIT"
] | 160
|
2017-06-20T17:12:13.000Z
|
2022-03-30T13:53:12.000Z
|
accelerator/migrations/023_alter_topics_field_office_hours.py
|
masschallenge/django-accelerator
|
8af898b574be3b8335edc8961924d1c6fa8b5fd5
|
[
"MIT"
] | null | null | null |
from __future__ import unicode_literals
from django.db import migrations, models
| 23.368421
| 76
| 0.655405
|
198549dbef342bfbbd642fd61a76b181c129ac11
| 1,085
|
py
|
Python
|
guanabara/mundo1/ex018.py
|
thekilian/Python-pratica
|
875661addd5b8eb4364bc638832c7ab55dcefce4
|
[
"MIT"
] | null | null | null |
guanabara/mundo1/ex018.py
|
thekilian/Python-pratica
|
875661addd5b8eb4364bc638832c7ab55dcefce4
|
[
"MIT"
] | null | null | null |
guanabara/mundo1/ex018.py
|
thekilian/Python-pratica
|
875661addd5b8eb4364bc638832c7ab55dcefce4
|
[
"MIT"
] | null | null | null |
# 018 - Faa um programa que leia um ngulo qualquer e mostre na tela o valor do seno, cosseno e tangente desse ngulo.
'''
from math import sin, cos, tan
ang = float(input('Digite um ngulo: '))
sen = sin(ang)
cos = cos(ang)
tan = tan(ang)
print('ngulo de {}: \n Seno = {:.2f} \n Cosseno = {:.2f} \n Tangente = {:.2f}'.format(ang, sen, cos, tan))
'''
'''
# apenas faltou conventer para radiano:
import math
ang = float(input('Digite um ngulo: '))
sen = math.sin(math.radians(ang))
cos = math.cos(math.radians(ang))
tan = math.tan(math.radians(ang))
print('O ngulo de {} tem o SENO de {:.2f}'.format(ang, sen))
print('O ngulo de {} tem o COSSENO de {:.2f}'.format(ang, cos))
print('O ngulo de {} tem a TANGENTE de {:.2f}'.format(ang, tan))
'''
# importando somente o que vamos utilizar: sin, cos, tan, radians
from math import sin, cos, tan, radians
ang = float(input('Digite um ngulo: '))
sen = sin(radians(ang))
cos = cos(radians(ang))
tan = tan(radians(ang))
print('ngulo de {}: \n Seno = {:.2f} \n Cosseno = {:.2f} \n Tangente = {:.2f}'.format(ang, sen, cos, tan))
| 31
| 119
| 0.648848
|
198848a18a09b75e39b55e572e9958bb26729aae
| 1,174
|
py
|
Python
|
models/basic_module.py
|
matsu911/CQTNet
|
e775f53fd91bbb9583d6640ae4e36f49031d1efd
|
[
"MIT"
] | 25
|
2020-04-10T05:43:49.000Z
|
2022-03-28T02:25:44.000Z
|
models/basic_module.py
|
matsu911/CQTNet
|
e775f53fd91bbb9583d6640ae4e36f49031d1efd
|
[
"MIT"
] | 2
|
2021-02-23T03:30:50.000Z
|
2021-06-28T09:02:38.000Z
|
models/basic_module.py
|
matsu911/CQTNet
|
e775f53fd91bbb9583d6640ae4e36f49031d1efd
|
[
"MIT"
] | 7
|
2020-04-10T05:43:51.000Z
|
2021-12-23T09:34:44.000Z
|
import torch
from torch import nn
import torchvision
import torch.nn.functional as F
import time
import os
| 29.35
| 84
| 0.602215
|
1989abd5efbf0b7dfe6d6083f611454b62427f76
| 654
|
py
|
Python
|
exp1_bot_detection/Cresci/Cresci.py
|
GabrielHam/SATAR_Twitter_Bot_Detection_with_Self-supervised_User_Representation_Learning
|
ac73e5deb9d748f02d1396d1458e716408470cc9
|
[
"MIT"
] | 5
|
2021-08-10T14:15:18.000Z
|
2022-03-09T07:06:19.000Z
|
exp1_bot_detection/Cresci/Cresci.py
|
GabrielHam/SATAR_Twitter_Bot_Detection_with_Self-supervised_User_Representation_Learning
|
ac73e5deb9d748f02d1396d1458e716408470cc9
|
[
"MIT"
] | null | null | null |
exp1_bot_detection/Cresci/Cresci.py
|
GabrielHam/SATAR_Twitter_Bot_Detection_with_Self-supervised_User_Representation_Learning
|
ac73e5deb9d748f02d1396d1458e716408470cc9
|
[
"MIT"
] | null | null | null |
import math
result = [1] * 4355
list = []
flag = ''
Sigma = ['A', 'C', 'T']
f = open('./cresci_text/finalTest1.txt', 'r', encoding='UTF-8')
for line in f:
list.append(line[line.find(' ', 2) + 1: -1])
f.close()
for substring in Sigma:
tryy(substring)
for i in result:
print(i)
| 15.571429
| 63
| 0.524465
|
198aafa829b773ab465bf52f7c98972087fa1385
| 3,119
|
py
|
Python
|
examples/smiley_face.py
|
Markichu/PythonAutoNifty
|
ab646601058297b6bfe14332f17b836ee3dfbe69
|
[
"MIT"
] | null | null | null |
examples/smiley_face.py
|
Markichu/PythonAutoNifty
|
ab646601058297b6bfe14332f17b836ee3dfbe69
|
[
"MIT"
] | 6
|
2021-11-24T00:48:57.000Z
|
2022-03-17T07:51:36.000Z
|
examples/smiley_face.py
|
Markichu/PythonAutoNifty
|
ab646601058297b6bfe14332f17b836ee3dfbe69
|
[
"MIT"
] | null | null | null |
import random
from pyautonifty.constants import DRAWING_SIZE, YELLOW, BLACK, MAGENTA, BLUE
from pyautonifty.pos import Pos
from pyautonifty.drawing import Drawing
from pyautonifty.renderer import Renderer
if __name__ == "__main__":
example_drawing = smiley_face(Drawing())
output_data = example_drawing.to_nifty_import() # Replace previous canvas contents in Nifty.Ink
print(f"Lines: {len(example_drawing)}, "
f"Points: {sum([len(line['points']) for line in example_drawing])}, "
f"Size: {(len(output_data) / 1024.0 ** 2):.2f}MB")
with open("output.txt", "w") as file:
file.write(output_data)
# Init render class.
renderer = Renderer()
# Render in a very accurate (but slower) way.
renderer.render(example_drawing, filename="smiley_face_%Y_%m_%d_%H-%M-%S-%f.png",
simulate=True, allow_transparency=True, proper_line_thickness=True, draw_as_bezier=True,
step_size=10)
| 43.319444
| 114
| 0.721064
|
198b6c8bdf9c4c45a62fc10ae148a99e4911a2b1
| 1,074
|
py
|
Python
|
cumulusci/tests/test_schema.py
|
davisagli/CumulusCI
|
fd74c324ad3ff662484b159395c639879011e711
|
[
"BSD-3-Clause"
] | 109
|
2015-01-20T14:28:48.000Z
|
2018-08-31T12:12:39.000Z
|
cumulusci/tests/test_schema.py
|
davisagli/CumulusCI
|
fd74c324ad3ff662484b159395c639879011e711
|
[
"BSD-3-Clause"
] | 365
|
2015-01-07T19:54:25.000Z
|
2018-09-11T15:10:02.000Z
|
cumulusci/tests/test_schema.py
|
davisagli/CumulusCI
|
fd74c324ad3ff662484b159395c639879011e711
|
[
"BSD-3-Clause"
] | 125
|
2015-01-17T16:05:39.000Z
|
2018-09-06T19:05:00.000Z
|
import json
import yaml
from jsonschema import validate
from cumulusci.utils.yaml import cumulusci_yml
| 32.545455
| 96
| 0.666667
|
198b7bfde744c3980b7b517559c0d495392afa36
| 7,650
|
py
|
Python
|
luxon/core/networking/sock.py
|
HieronymusCrouse/luxon
|
b0b08c103936adcbb3dd03b1701d44a65de8f61e
|
[
"BSD-3-Clause"
] | 7
|
2018-02-27T00:18:02.000Z
|
2019-05-16T16:57:00.000Z
|
luxon/core/networking/sock.py
|
HieronymusCrouse/luxon
|
b0b08c103936adcbb3dd03b1701d44a65de8f61e
|
[
"BSD-3-Clause"
] | 47
|
2018-01-23T13:49:28.000Z
|
2019-06-06T13:14:59.000Z
|
luxon/core/networking/sock.py
|
HieronymusCrouse/luxon
|
b0b08c103936adcbb3dd03b1701d44a65de8f61e
|
[
"BSD-3-Clause"
] | 14
|
2018-01-15T08:47:11.000Z
|
2019-12-27T12:05:41.000Z
|
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2020 Christiaan Frans Rademan <chris@fwiw.co.za>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
import ssl
import struct
import socket
import select
import pickle
from multiprocessing import Lock
def Pipe():
sock1, sock2 = socket.socketpair()
sock1.setblocking(False)
sock2.setblocking(False)
return (Socket(sock1), Socket(sock2),)
| 33.116883
| 79
| 0.555817
|
198cce97dd571e2e8a46ea89d848568e280efd25
| 739
|
py
|
Python
|
merge.py
|
Graze-Lab/SDE-of-species
|
c53ca05ff840e722fec3d71b5794057713d221f8
|
[
"MIT"
] | null | null | null |
merge.py
|
Graze-Lab/SDE-of-species
|
c53ca05ff840e722fec3d71b5794057713d221f8
|
[
"MIT"
] | null | null | null |
merge.py
|
Graze-Lab/SDE-of-species
|
c53ca05ff840e722fec3d71b5794057713d221f8
|
[
"MIT"
] | null | null | null |
#! /usr/bin/env python3
"A script to perform the linear regression and create the plot."
# Python program to
# demonstrate merging of
# two files
# Creating a list of filenames
filenames = ['A.591-search-immune-dmel-FlyBase_IDs.txt', 'B.432_search-defense-dmel-FlyBase_IDs.txt']
# Open file3 in write mode
with open('C.search-immune-defense-dmel-FlyBase_IDs.txt', 'w') as outfile:
# Iterate through list
for names in filenames:
# Open each file in read mode
with open(names) as infile:
# read the data from file1 and
# file2 and write it in file3
outfile.write(infile.read())
# Add '\n' to enter data of file2
# from next line
outfile.write("\n")
| 26.392857
| 101
| 0.653586
|
198e2ea49efeb318a688dffd17a8ff15bcc42c01
| 13
|
py
|
Python
|
dmm/dmm_data/__init__.py
|
voghoei/Different-Models
|
ede4a48a7960ccb4a8519bfb77d234328f2936d1
|
[
"MIT"
] | 11
|
2017-11-16T13:01:47.000Z
|
2021-12-26T20:07:24.000Z
|
optvaedatasets/__init__.py
|
rahulk90/inference_introspection
|
102b3cf72abae8d66718b945df365edd4a23a62d
|
[
"MIT"
] | null | null | null |
optvaedatasets/__init__.py
|
rahulk90/inference_introspection
|
102b3cf72abae8d66718b945df365edd4a23a62d
|
[
"MIT"
] | null | null | null |
all=['load']
| 6.5
| 12
| 0.538462
|
19901da7c7a1960491cefcc10a95446ff706e6be
| 10,996
|
py
|
Python
|
game/sdktools/python/global/lib/site-packages/python_sfm.py
|
Andrej730/python-sfm
|
dc693b9d221fa046000a41ffdbb59b5ddca6d9dc
|
[
"MIT"
] | null | null | null |
game/sdktools/python/global/lib/site-packages/python_sfm.py
|
Andrej730/python-sfm
|
dc693b9d221fa046000a41ffdbb59b5ddca6d9dc
|
[
"MIT"
] | null | null | null |
game/sdktools/python/global/lib/site-packages/python_sfm.py
|
Andrej730/python-sfm
|
dc693b9d221fa046000a41ffdbb59b5ddca6d9dc
|
[
"MIT"
] | null | null | null |
# encoding: utf-8
import os
import pydoc
import inspect
import PySide
import vs
import sfm
import sfmApp
class SFMAttribute(object):
def list_attrs(o):
current_attribute = o.FirstAttribute()
attributes = []
while current_attribute is not None:
attributes.append(SFMAttribute(current_attribute))
current_attribute = current_attribute.NextAttribute()
return attributes
def getActiveControlsList():
animset = sfm.GetCurrentAnimationSet()
c = sfmApp.GetDocumentRoot().settings.graphEditorState.activeControlList
return c
def getAnimationSetByName(name):
shot = sfm.GetCurrentShot()
for animset in shot.animationSets:
if animset.name.GetValue() == name:
return SFMAnimationSet(animset)
def set_override_materials(override=True, jump=False):
"""Toggle override materials for current animation set
by emulating clicking on "Add / Remove Override Materials" menu button"""
qApp = PySide.QtGui.QApplication.instance()
top = qApp.topLevelWidgets()
override_status = 'Add Override Materials' if override else 'Remove Override Materials'
for widget in top:
if isinstance(widget, PySide.QtGui.QMenu):
try:
actions = widget.actions()
override_action = None
jump_to_ev_action = None
for action in actions:
if action.text() == 'Show in Element Viewer':
jump_to_ev_action = action.menu().actions()[1]
if action.text() == override_status:
override_action = action
if override_action:
override_action.trigger()
if jump and jump_to_ev_action:
jump_to_ev_action.trigger()
except RuntimeError:
pass
def debug_breakpoint(*kwargs):
"""Usable as a breakpoint for debugging animation set and dag scripts
via external debugger - for example Wing IDE (can't recommend it enough).
More on SFM scripts debugging: https://wingware.com/doc/howtos/sfm
"""
sfmApp.ProcessEvents()
if __name__ == '__main__':
main()
| 29.013193
| 99
| 0.636049
|
19918c7e3202a1fa8b8c6f798ca7ec26ed75c1a5
| 1,778
|
py
|
Python
|
waterApp/migrations/0014_gwmonitoringkobo.py
|
csisarep/groundwater_dashboard
|
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
|
[
"MIT"
] | null | null | null |
waterApp/migrations/0014_gwmonitoringkobo.py
|
csisarep/groundwater_dashboard
|
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
|
[
"MIT"
] | null | null | null |
waterApp/migrations/0014_gwmonitoringkobo.py
|
csisarep/groundwater_dashboard
|
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
|
[
"MIT"
] | null | null | null |
# Generated by Django 2.2 on 2021-09-14 07:38
from django.db import migrations, models
| 46.789474
| 174
| 0.596738
|
1991dc4138a00addb007b9c008442a088b976ece
| 255
|
py
|
Python
|
graphs.py
|
spencerparkin/ComplexFunctionGrapher
|
780eea1fa704d3dcf0f41e701acbe709d0e8c410
|
[
"MIT"
] | null | null | null |
graphs.py
|
spencerparkin/ComplexFunctionGrapher
|
780eea1fa704d3dcf0f41e701acbe709d0e8c410
|
[
"MIT"
] | null | null | null |
graphs.py
|
spencerparkin/ComplexFunctionGrapher
|
780eea1fa704d3dcf0f41e701acbe709d0e8c410
|
[
"MIT"
] | null | null | null |
# graphs.py
# TODO: Import zeta function here or assume that the calling/loading program puts it into our global scope for us?
| 25.5
| 114
| 0.678431
|
1992027ec84925790a7d6fb4bda0cd8820388c0a
| 2,891
|
py
|
Python
|
src/rhc_hqa/rhc_hqa.py
|
Minyus/rhc_hqa
|
2b9f37a8b6ddb9dd36c08764acd2dcf9cbd7c551
|
[
"Apache-2.0"
] | null | null | null |
src/rhc_hqa/rhc_hqa.py
|
Minyus/rhc_hqa
|
2b9f37a8b6ddb9dd36c08764acd2dcf9cbd7c551
|
[
"Apache-2.0"
] | null | null | null |
src/rhc_hqa/rhc_hqa.py
|
Minyus/rhc_hqa
|
2b9f37a8b6ddb9dd36c08764acd2dcf9cbd7c551
|
[
"Apache-2.0"
] | null | null | null |
import pandas as pd
import numpy as np
from sklearn.linear_model import LogisticRegression
from lightgbm import LGBMRegressor
| 32.852273
| 80
| 0.649256
|
1992310a23c16a6b24ee79181f9ba76bf057b0f3
| 2,301
|
py
|
Python
|
257.py
|
wilbertgeng/LeetCode_exercise
|
f00c08e0d28ffa88d61d4262c6d1f49f1fa91ebc
|
[
"MIT"
] | null | null | null |
257.py
|
wilbertgeng/LeetCode_exercise
|
f00c08e0d28ffa88d61d4262c6d1f49f1fa91ebc
|
[
"MIT"
] | null | null | null |
257.py
|
wilbertgeng/LeetCode_exercise
|
f00c08e0d28ffa88d61d4262c6d1f49f1fa91ebc
|
[
"MIT"
] | null | null | null |
"""257. Binary Tree Paths"""
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
| 29.883117
| 72
| 0.49761
|
1992ec78bc5a151f3be755b884f124a14b674536
| 213
|
py
|
Python
|
bot/tasks/__init__.py
|
gugarosa/botty
|
5d286c87716cb3ee55a58bdc560024be2276589f
|
[
"MIT"
] | null | null | null |
bot/tasks/__init__.py
|
gugarosa/botty
|
5d286c87716cb3ee55a58bdc560024be2276589f
|
[
"MIT"
] | null | null | null |
bot/tasks/__init__.py
|
gugarosa/botty
|
5d286c87716cb3ee55a58bdc560024be2276589f
|
[
"MIT"
] | null | null | null |
"""A tasks package, used to support different tasks that the bot can execute.
Essentialy, one can define any kind of operation that the bot can perform over a type
of input data (audio, text, video and voice).
"""
| 53.25
| 85
| 0.760563
|
1993e0484cd76cbe8ee03395dd60ee7a00db241f
| 2,179
|
py
|
Python
|
crm/forms.py
|
zhangyafeii/CRM
|
4d93fb276c7210676590da48b18d8e72cc202ef0
|
[
"MIT"
] | null | null | null |
crm/forms.py
|
zhangyafeii/CRM
|
4d93fb276c7210676590da48b18d8e72cc202ef0
|
[
"MIT"
] | null | null | null |
crm/forms.py
|
zhangyafeii/CRM
|
4d93fb276c7210676590da48b18d8e72cc202ef0
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
"""
@Datetime: 2018/10/23
@Author: Zhang Yafei
"""
from django.forms import ModelForm, forms
from crm import models
| 35.145161
| 119
| 0.620009
|
199526a23444f21fe4ced48163607211a83fd853
| 3,911
|
py
|
Python
|
api/user_api.py
|
HuQi2018/BiSheServer
|
66fd77865e131f0a06313562b5d127e530128944
|
[
"Apache-2.0"
] | 44
|
2021-06-03T04:01:30.000Z
|
2022-03-31T15:46:00.000Z
|
api/user_api.py
|
HuQi2018/BiSheServer
|
66fd77865e131f0a06313562b5d127e530128944
|
[
"Apache-2.0"
] | 1
|
2022-02-21T05:40:01.000Z
|
2022-03-17T10:50:51.000Z
|
api/user_api.py
|
HuQi2018/BiSheServer
|
66fd77865e131f0a06313562b5d127e530128944
|
[
"Apache-2.0"
] | 8
|
2021-06-05T17:13:35.000Z
|
2022-03-24T05:04:30.000Z
|
import uuid
from django.core.files.base import ContentFile
from django.core.files.storage import default_storage
from django.db.models import Q
from BiSheServer import settings
from api.model_json import queryset_to_json
from user.models import UsersPerfer, UsersDetail, UserTag
# api
#
#
def modify_user_tag(self, user_id, tag_type, tag_name, tag_weight):
user_tag = UserTag.objects.filter(Q(user_id=user_id) & Q(tag_type=tag_type) & Q(tag_name=tag_name))
if user_tag.exists(): #
if type(tag_weight) == str: #
old_tag_weight = int(user_tag.first().tag_weight)
try:
tag_weight = int(tag_weight)
except Exception as ex:
print("" + ex.__str__())
return ""
if old_tag_weight != 0: #
tag_weight = old_tag_weight + tag_weight
else: #
tag_weight = 5 + tag_weight
user_tag.update(tag_weight=str(tag_weight))
else:
self.add_user_tag(user_id, tag_type, tag_name, tag_weight)
#
#
| 35.554545
| 116
| 0.611864
|
199538a4a4f978d0b56aadb122776630718bac24
| 1,777
|
py
|
Python
|
Diretide/lib.py
|
sleibrock/dotacli
|
e361fbcf787f13232fcf8994b839d4c9f08bc67a
|
[
"MIT"
] | null | null | null |
Diretide/lib.py
|
sleibrock/dotacli
|
e361fbcf787f13232fcf8994b839d4c9f08bc67a
|
[
"MIT"
] | null | null | null |
Diretide/lib.py
|
sleibrock/dotacli
|
e361fbcf787f13232fcf8994b839d4c9f08bc67a
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
lib.py
"""
from string import printable as printable_chrs
from collections import namedtuple
from requests import get as re_get
from datetime import datetime
# Define constants
API_URL = "http://dailydota2.com/match-api"
Match = namedtuple("Match", ["timediff", "series_type", "link", "starttime",
"status", "starttime_unix", "comment", "viewers",
"team1", "team2", "league"])
def print_match(m, longest):
"Do all the match info here"
print("=== {} (best of {}) ===".format(m.league["name"], m.series_type))
print("{[team_name]:<{width}} vs. {[team_name]:>{width}}".format(
m.team1, m.team2, width=longest))
print(display_time(m))
print()
def display_time(m):
"""Convert unix time to readable"""
x = int(m.timediff)
if x <= 0:
return "***Currently Running***"
return "Time until: {}".format(
datetime.fromtimestamp(x).strftime("%H:%M:%S"))
def main(*args, **kwargs):
"""
Main function
Retrieves, forms data, and prints out information
"""
print()
# First retrieve the JSON
data = get_url(API_URL)
# Interpret results into a list of matches
matches = [Match(**unpack) for unpack in data["matches"]]
# Find the longest team name and create dynamic alignment
longest = get_longest(matches)
# Print out a list of all matches (possibly order by the Unix timestamp)
for match in matches:
print_match(match, longest)
if __name__ == "__main__":
main()
# end
| 26.924242
| 78
| 0.621835
|
1996ff9cbd376245bbd4ada8ffdff6a62803fa08
| 417
|
py
|
Python
|
hash-tool/vv_hash.py
|
amjunliang/virtualview_tools
|
7fcf62134b0a23a71bb8f4b54a6aac19cf858ef6
|
[
"MIT"
] | 186
|
2017-12-06T09:17:07.000Z
|
2022-01-10T04:04:09.000Z
|
hash-tool/vv_hash.py
|
amjunliang/virtualview_tools
|
7fcf62134b0a23a71bb8f4b54a6aac19cf858ef6
|
[
"MIT"
] | 16
|
2017-12-18T04:15:57.000Z
|
2021-04-15T06:50:37.000Z
|
hash-tool/vv_hash.py
|
amjunliang/virtualview_tools
|
7fcf62134b0a23a71bb8f4b54a6aac19cf858ef6
|
[
"MIT"
] | 47
|
2018-01-12T06:23:26.000Z
|
2022-02-22T05:56:59.000Z
|
import sys
if len(sys.argv) <= 1:
print("python vv_hash.py property_name")
exit(0)
propertyName = sys.argv[1]
if len(propertyName) == 0:
print("empty element name")
exit(0)
hashCode = 0
for i in range(0, len(propertyName)):
hashCode = (31 * hashCode + ord(propertyName[i])) & 0xFFFFFFFF
if hashCode > 0x7FFFFFFF:
hashCode = hashCode - 0x100000000
print("hash code: %d" % (hashCode))
| 24.529412
| 66
| 0.654676
|
1998df4907ac93692e766bee0d9c71f2e17b5c12
| 237
|
py
|
Python
|
pycounter/test/test_jr1_tabs.py
|
loadbrain/pycounter
|
e5533d0ebe3685df0c29f8e491ea6dd1c14c6b66
|
[
"MIT"
] | null | null | null |
pycounter/test/test_jr1_tabs.py
|
loadbrain/pycounter
|
e5533d0ebe3685df0c29f8e491ea6dd1c14c6b66
|
[
"MIT"
] | 2
|
2020-08-27T14:12:44.000Z
|
2020-08-27T14:16:18.000Z
|
pycounter/test/test_jr1_tabs.py
|
loadbrain/pycounter
|
e5533d0ebe3685df0c29f8e491ea6dd1c14c6b66
|
[
"MIT"
] | null | null | null |
"""Test COUNTER JR1 journal report (TSV)"""
| 23.7
| 71
| 0.662447
|
199b9fe3c8a3ba98e7b1141db31d1f32f85abbd2
| 545
|
py
|
Python
|
manage.py
|
kojwangbora/elly-blog
|
95946ece071784fa5c15c21618011cbb97ebfc46
|
[
"MIT"
] | null | null | null |
manage.py
|
kojwangbora/elly-blog
|
95946ece071784fa5c15c21618011cbb97ebfc46
|
[
"MIT"
] | null | null | null |
manage.py
|
kojwangbora/elly-blog
|
95946ece071784fa5c15c21618011cbb97ebfc46
|
[
"MIT"
] | null | null | null |
from app import create_app, db
from flask_migrate import Migrate
from app.models import User, Posts
from flask_script import Manager,Server
app = create_app()
# manager = Manager(app)
# manager.add_command('server', Server)
# #Creating migration instance
# migrate = Migrate(app, db)
# manager.add_command('db',MigrateCommand)
# # @manager.shell
# @manager.shell_context_processor
# def make_shell_context():
# return dict(db = db, User =User, Posts=Posts)
# if __name__ == '__main__':
# # manager.debug = True
# app.run()
| 23.695652
| 51
| 0.717431
|
199c463aaa4e8ff9bc128e9fe6eb09901f8c3ffb
| 2,354
|
py
|
Python
|
API/AdminPanel/smoke_all_pages/credentials.py
|
Mikhail-QA/HS
|
8ddbc09a0d1493128f3af6b8078c295609908dd7
|
[
"Apache-2.0"
] | null | null | null |
API/AdminPanel/smoke_all_pages/credentials.py
|
Mikhail-QA/HS
|
8ddbc09a0d1493128f3af6b8078c295609908dd7
|
[
"Apache-2.0"
] | null | null | null |
API/AdminPanel/smoke_all_pages/credentials.py
|
Mikhail-QA/HS
|
8ddbc09a0d1493128f3af6b8078c295609908dd7
|
[
"Apache-2.0"
] | null | null | null |
#
# .
path_admin_schedules_grade_1 = '/schedules?grade=1&school=true&'
path_admin_schedules_grade_2 = '/schedules?grade=2&school=true&'
path_admin_schedules_grade_3 = '/schedules?grade=3&school=true&'
path_admin_schedules_grade_4 = '/schedules?grade=4&school=true&'
path_admin_schedules_grade_5 = '/schedules?grade=5&school=true&'
path_admin_schedules_grade_6 = '/schedules?grade=6&school=true&'
path_admin_schedules_grade_7 = '/schedules?grade=7&school=true&'
path_admin_schedules_grade_8 = '/schedules?grade=8&school=true&'
path_admin_schedules_grade_9 = '/schedules?grade=9&school=true&'
path_admin_schedules_grade_10 = '/schedules?grade=10&school=true&'
path_admin_schedules_grade_11 = '/schedules?grade=11&school=true&'
# \
path_admin_add_subject = '/schedules?'
path_admin_delete_subject = '/schedules/5583026?'
#
path_admin_item_editor = '/schedule_items.json?schedule_id=3908531&' #
path_admin_add_topic = '/topics?' #
path_admin_add_lesson = 'lessons.json?' #
path_admin_lesson_for_day = '/schedule_items.json?' #
path_admin_remove_lesson = '/lessons/37865.json?' #
path_admin_remove_topic = '/topics/24273?addLessonHide=true&addLessonNameEvent=click&calendarActive=false&editTopicNameHide=true&lessonsHide=false&name=&schedule_id=3908531&subject_id=201&'
path_admin_save_date_ege = '/schedules/3908531?' #
#
path_admin_monthly_homework_editor = '/monthly_homeworks?schedule_id=3908531&' #
path_admin_create_monthly_homework = '/monthly_homeworks?' #
path_admin_delete_monthly_homework = '/monthly_homeworks/7229?' #
#
path_admin_editor_ege = '/schedules?grade=11&school=false&' #
path_admin_attach_subject_ege = '/schedules?' #
path_admin_delete_subject_ege = '/schedules/5583707?' #
path_admin_add_topic = '/topics?' #
| 52.311111
| 193
| 0.800765
|
199c573a26d9f3609be1f4e385345250d059dabc
| 248
|
py
|
Python
|
swagger2/__init__.py
|
ppbug/swagger2
|
a60585a85aad9c16757e67ff70d30e70657a78b8
|
[
"MIT"
] | 1
|
2021-07-12T07:06:03.000Z
|
2021-07-12T07:06:03.000Z
|
swagger2/__init__.py
|
ppbug/swagger2
|
a60585a85aad9c16757e67ff70d30e70657a78b8
|
[
"MIT"
] | null | null | null |
swagger2/__init__.py
|
ppbug/swagger2
|
a60585a85aad9c16757e67ff70d30e70657a78b8
|
[
"MIT"
] | null | null | null |
from .loader import *
from .swagger import *
| 20.666667
| 36
| 0.697581
|
199d8a7e9157f48b6df5a88dec9570242bb4b50a
| 963
|
py
|
Python
|
2021/aoc07.py
|
wolfgangmuender/AdventOfCode
|
3956c245f6d3e789cb5424ac54832ebcfc03eb21
|
[
"Apache-2.0"
] | null | null | null |
2021/aoc07.py
|
wolfgangmuender/AdventOfCode
|
3956c245f6d3e789cb5424ac54832ebcfc03eb21
|
[
"Apache-2.0"
] | null | null | null |
2021/aoc07.py
|
wolfgangmuender/AdventOfCode
|
3956c245f6d3e789cb5424ac54832ebcfc03eb21
|
[
"Apache-2.0"
] | null | null | null |
with open("input/input07.txt") as f:
content = f.read().splitlines()
positions = list(map(lambda x: int(x), content[0].split(",")))
max_pos = max(positions)
min_pos = min(positions)
possible_pos = range(min_pos, max_pos + 1)
fuel_costs1 = []
for align_pos in possible_pos:
fuel_costs1.append(sum([abs(pos - align_pos) for pos in positions]))
final_fuel_cost1 = min(fuel_costs1)
align_position1 = possible_pos[fuel_costs1.index(final_fuel_cost1)]
print("Solution 1: the crabs need to spend {} fuel to align at position {}".format(final_fuel_cost1, align_position1))
fuel_costs2 = []
for align_pos in possible_pos:
fuel_costs2.append(sum([int(abs(pos - align_pos) * (abs(pos - align_pos) + 1) / 2) for pos in positions]))
final_fuel_cost2 = min(fuel_costs2)
align_position2 = possible_pos[fuel_costs2.index(final_fuel_cost2)]
print("Solution 2: the crabs need to spend {} fuel to align at position {}".format(final_fuel_cost2, align_position2))
| 35.666667
| 118
| 0.74351
|
199dc81e3c59d04bf93fe983d5b45a4485997a89
| 2,227
|
py
|
Python
|
sources/install_deps.py
|
Radeon4650/PocketBudgetTracker
|
61b792f648e73e8043e42e0e1c55b3acf1868f90
|
[
"Apache-2.0"
] | 1
|
2018-12-03T12:41:50.000Z
|
2018-12-03T12:41:50.000Z
|
sources/install_deps.py
|
Radeon4650/PocketBudgetTracker
|
61b792f648e73e8043e42e0e1c55b3acf1868f90
|
[
"Apache-2.0"
] | 16
|
2018-10-08T17:37:52.000Z
|
2019-01-06T12:02:54.000Z
|
sources/install_deps.py
|
Radeon4650/PocketBudgetTracker
|
61b792f648e73e8043e42e0e1c55b3acf1868f90
|
[
"Apache-2.0"
] | 1
|
2018-10-11T20:01:05.000Z
|
2018-10-11T20:01:05.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2018 PocketBudgetTracker. All rights reserved.
Author: Andrey Shelest (khadsl1305@gmail.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import os
import os.path
import subprocess
import sys
modules_dir = os.path.dirname(__file__)
req_file_name = 'requirements.txt'
if __name__ == '__main__':
installer = Installer(True)
# Upgrade pip
installer.install('pip')
# Install all modules dependencies
installer.install_modules_deps()
sys.exit(0)
| 28.922078
| 76
| 0.671756
|
199fc92154f499c85aed3bce44e91934109ae7d3
| 5,305
|
py
|
Python
|
tools/utils/building/layer.py
|
shinh/dldt
|
693ab4e79a428e0801f17f4511b129a3fa8f4a62
|
[
"Apache-2.0"
] | 1
|
2021-02-20T21:48:36.000Z
|
2021-02-20T21:48:36.000Z
|
tools/utils/building/layer.py
|
erinpark33/dldt
|
edd86d090592f7779f4dbb2681546e1f4e81284f
|
[
"Apache-2.0"
] | null | null | null |
tools/utils/building/layer.py
|
erinpark33/dldt
|
edd86d090592f7779f4dbb2681546e1f4e81284f
|
[
"Apache-2.0"
] | 1
|
2021-02-19T01:06:12.000Z
|
2021-02-19T01:06:12.000Z
|
"""
Copyright (C) 2018-2019 Intel Corporation
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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from ..biases import Biases
from ..weights import Weights
| 33.575949
| 153
| 0.489915
|
19a02ddbcaad9d7bf3192c753f7e060611b72ae8
| 19,686
|
py
|
Python
|
tests/test_lightningStub.py
|
engenegr/lnd_grpc
|
89336bc83fcfa286dd7927e92fbc88293bd29547
|
[
"MIT"
] | null | null | null |
tests/test_lightningStub.py
|
engenegr/lnd_grpc
|
89336bc83fcfa286dd7927e92fbc88293bd29547
|
[
"MIT"
] | null | null | null |
tests/test_lightningStub.py
|
engenegr/lnd_grpc
|
89336bc83fcfa286dd7927e92fbc88293bd29547
|
[
"MIT"
] | null | null | null |
import os
import time
import unittest
import bitcoin.rpc
import grpc
import lnd_grpc.lnd_grpc as py_rpc
import lnd_grpc.protos.rpc_pb2 as rpc_pb2
# from google.protobuf.internal.containers import RepeatedCompositeFieldContainer
#######################
# Configure variables #
#######################
CWD = os.getcwd()
ALICE_LND_DIR = '/Users/will/regtest/.lnd/'
ALICE_NETWORK = 'regtest'
ALICE_RPC_HOST = '127.0.0.1'
ALICE_RPC_PORT = '10009'
ALICE_MACAROON_PATH = '/Users/will/regtest/.lnd/data/chain/bitcoin/regtest/admin.macaroon'
ALICE_PEER_PORT = '9735'
ALICE_HOST_ADDR = ALICE_RPC_HOST + ':' + ALICE_PEER_PORT
BOB_LND_DIR = '/Users/will/regtest/.lnd2/'
BOB_NETWORK = 'regtest'
BOB_RPC_HOST = '127.0.0.1'
BOB_RPC_PORT = '11009'
BOB_MACAROON_PATH = '/Users/will/regtest/.lnd2/data/chain/bitcoin/regtest/admin.macaroon'
BOB_PEER_PORT = '9734'
BOB_HOST_ADDR = BOB_RPC_HOST + ':' + BOB_PEER_PORT
BITCOIN_SERVICE_PORT = 18443
BITCOIN_CONF_FILE = '/Users/will/regtest/.bitcoin/bitcoin.conf'
BITCOIN_ADDR = None
DEBUG_LEVEL = 'error'
SLEEP_TIME = 0.5
##################
# Test framework #
##################i
| 39.689516
| 99
| 0.642436
|
19a16d103bbd6587ea4e474ed212a036bf6bb483
| 3,683
|
py
|
Python
|
tvb_hpc/metric.py
|
DeLaVlag/tvb-hpc
|
6559707dfee8ec712d9624aaf441f9901919fe63
|
[
"Apache-2.0"
] | 3
|
2017-02-22T10:17:19.000Z
|
2019-06-20T13:13:53.000Z
|
tvb_hpc/metric.py
|
DeLaVlag/tvb-hpc
|
6559707dfee8ec712d9624aaf441f9901919fe63
|
[
"Apache-2.0"
] | 27
|
2017-02-07T10:25:31.000Z
|
2020-07-01T09:48:13.000Z
|
tvb_hpc/metric.py
|
DeLaVlag/tvb-hpc
|
6559707dfee8ec712d9624aaf441f9901919fe63
|
[
"Apache-2.0"
] | 10
|
2017-03-06T10:52:02.000Z
|
2020-11-20T02:17:17.000Z
|
# Copyright 2018 TVB-HPC contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from .base import BaseKernel
| 26.307143
| 78
| 0.519414
|
19a1cf2092a5e1441835b5519079835b5bb7b437
| 484
|
py
|
Python
|
20_valid_parens.py
|
claytonjwong/leetcode-py
|
16bbf8ac0ba5c80fe3ef67ade0d61a12991270a7
|
[
"MIT"
] | 1
|
2020-07-15T14:16:23.000Z
|
2020-07-15T14:16:23.000Z
|
20_valid_parens.py
|
claytonjwong/leetcode-py
|
16bbf8ac0ba5c80fe3ef67ade0d61a12991270a7
|
[
"MIT"
] | null | null | null |
20_valid_parens.py
|
claytonjwong/leetcode-py
|
16bbf8ac0ba5c80fe3ef67ade0d61a12991270a7
|
[
"MIT"
] | null | null | null |
#
# 20. Valid Parentheses
#
# Q: https://leetcode.com/problems/valid-parentheses/
# A: https://leetcode.com/problems/valid-parentheses/discuss/9214/Kt-Js-Py3-Cpp-Stack
#
| 26.888889
| 85
| 0.506198
|
19a1f5173da1a19ab9a723e6c007b756a7bf4d27
| 1,474
|
py
|
Python
|
2016/23/solution.py
|
Artemigos/advent-of-code
|
0b2ae6af3788b9e6891219b2b64ce0d510b3e1aa
|
[
"MIT"
] | null | null | null |
2016/23/solution.py
|
Artemigos/advent-of-code
|
0b2ae6af3788b9e6891219b2b64ce0d510b3e1aa
|
[
"MIT"
] | null | null | null |
2016/23/solution.py
|
Artemigos/advent-of-code
|
0b2ae6af3788b9e6891219b2b64ce0d510b3e1aa
|
[
"MIT"
] | null | null | null |
import common
lines = common.read_file('2016/23/data.txt').splitlines()
# part 1
eggs = 7
# part 2
eggs = 12
registers = dict(a=eggs, b=0, c=0, d=0)
instructions = [x.split(' ') for x in lines]
i = 0
while i < len(instructions) and i >= 0:
print(registers)
instr = instructions[i]
code = instr[0]
if code == 'cpy':
if is_reg(instr[2]):
registers[instr[2]] = get_val(instr[1])
i += 1
elif code == 'inc':
if is_reg(instr[1]):
registers[instr[1]] += 1
i += 1
elif code == 'dec':
if is_reg(instr[1]):
registers[instr[1]] -= 1
i += 1
elif code == 'jnz':
if get_val(instr[1]) != 0:
i += get_val(instr[2])
else:
i += 1
else: # tgl
instr_offset = get_val(instr[1])
instr_idx = i + instr_offset
if 0 <= instr_idx < len(instructions):
to_tgl = instructions[instr_idx]
if to_tgl[0] == 'inc':
to_tgl[0] = 'dec'
elif to_tgl[0] == 'dec' or to_tgl[0] == 'tgl':
to_tgl[0] = 'inc'
elif to_tgl[0] == 'jnz':
to_tgl[0] = 'cpy'
else: # cpy
to_tgl[0] = 'jnz'
i += 1
print('a=', registers['a'])
| 24.566667
| 58
| 0.501357
|
19a5490d295df8c74ba7a1b675a66941ae74fa96
| 798
|
py
|
Python
|
game/gamesrc/conf/at_server_startstop.py
|
abbacode/avaloria
|
02e1805ac6e74543c96408b7951429f94bc140ca
|
[
"ClArtistic"
] | null | null | null |
game/gamesrc/conf/at_server_startstop.py
|
abbacode/avaloria
|
02e1805ac6e74543c96408b7951429f94bc140ca
|
[
"ClArtistic"
] | null | null | null |
game/gamesrc/conf/at_server_startstop.py
|
abbacode/avaloria
|
02e1805ac6e74543c96408b7951429f94bc140ca
|
[
"ClArtistic"
] | null | null | null |
"""
This module contains functions that are imported and called by the
server whenever it changes its running status. At the point these
functions are run, all applicable hooks on individual objects have
already been executed. The main purpose of this is module is to have a
safe place to initialize eventual custom modules that your game needs
to start up or load.
The module should define at least these global functions:
at_server_start()
at_server_stop()
The module used is defined by settings.AT_SERVER_STARTSTOP_MODULE.
"""
def at_server_start():
"""
This is called every time the server starts up (also after a
reload or reset).
"""
pass
def at_server_stop():
"""
This is called just before a server is shut down, reloaded or
reset.
"""
pass
| 25.741935
| 70
| 0.738095
|
19a70dde6b545bdfbf0067d8087a6296f69db3a9
| 407
|
py
|
Python
|
registration/urls.py
|
NJnisarg/IEEEProfMatch
|
0a67108c910b40f878cc3e0ed9f37ec59089f02d
|
[
"MIT"
] | null | null | null |
registration/urls.py
|
NJnisarg/IEEEProfMatch
|
0a67108c910b40f878cc3e0ed9f37ec59089f02d
|
[
"MIT"
] | null | null | null |
registration/urls.py
|
NJnisarg/IEEEProfMatch
|
0a67108c910b40f878cc3e0ed9f37ec59089f02d
|
[
"MIT"
] | null | null | null |
from django.urls import path
from . import views
urlpatterns = [
path('register/student/', views.StudentCreate.as_view(), name='student-register'),
path('register/prof/', views.ProfCreate.as_view(), name='prof-register'),
path('remove/student/<pk>/', views.StudentRemove.as_view(), name='student-remove'),
path('remove/prof/<pk>/', views.ProfRemove.as_view(), name='prof-remove'),
]
| 45.222222
| 88
| 0.687961
|
19a87db683c9165ec3ec45d64b90db5e4bc925f8
| 3,272
|
py
|
Python
|
src/experiment/experiment.py
|
ricoms/credit-fraud-dealing-with-imbalanced-datasets-mlops
|
aa483832493faa88affd00eff5489d03506abdeb
|
[
"MIT"
] | 5
|
2021-04-29T22:20:08.000Z
|
2021-05-21T03:29:52.000Z
|
src/experiment/experiment.py
|
ricoms/credit-fraud-dealing-with-imbalanced-datasets-mlops
|
aa483832493faa88affd00eff5489d03506abdeb
|
[
"MIT"
] | null | null | null |
src/experiment/experiment.py
|
ricoms/credit-fraud-dealing-with-imbalanced-datasets-mlops
|
aa483832493faa88affd00eff5489d03506abdeb
|
[
"MIT"
] | 3
|
2021-04-29T22:41:59.000Z
|
2021-10-03T20:06:05.000Z
|
import sys
from dataclasses import dataclass
from io import StringIO
from pathlib import Path
from typing import Any
import numpy as np
from sklearn.model_selection import StratifiedKFold
from utils.logger import logger
from .artifacts import ExperimentArtifacts
INPUT_COLUMNS = [
"Time", "V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9",
"V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19", "V20",
"V21", "V22", "V23", "V24", "V25", "V26", "V27", "V28", "Amount", "Class",
]
| 31.161905
| 90
| 0.573655
|
19aaba565d436c4904687e34d86883a59ba3510f
| 92
|
py
|
Python
|
29.operacoes_com_lista/17.exercicio4.py
|
robinson-1985/python-zero-dnc
|
df510d67e453611fcd320df1397cdb9ca47fecb8
|
[
"MIT"
] | null | null | null |
29.operacoes_com_lista/17.exercicio4.py
|
robinson-1985/python-zero-dnc
|
df510d67e453611fcd320df1397cdb9ca47fecb8
|
[
"MIT"
] | null | null | null |
29.operacoes_com_lista/17.exercicio4.py
|
robinson-1985/python-zero-dnc
|
df510d67e453611fcd320df1397cdb9ca47fecb8
|
[
"MIT"
] | null | null | null |
# 4.Crie uma lista que v de 1 at 100.
list = [ cont for cont in range(1,101)]
print(list)
| 23
| 39
| 0.673913
|
19ab282eb7fda2cf0e66686848e93a742af27a72
| 1,385
|
py
|
Python
|
src/responsibility/problems/drsc_fig3.py
|
pik-gane/pyresponsibility
|
e0f43be1a9712754832bb97b3797851cdb24842d
|
[
"BSD-2-Clause"
] | null | null | null |
src/responsibility/problems/drsc_fig3.py
|
pik-gane/pyresponsibility
|
e0f43be1a9712754832bb97b3797851cdb24842d
|
[
"BSD-2-Clause"
] | null | null | null |
src/responsibility/problems/drsc_fig3.py
|
pik-gane/pyresponsibility
|
e0f43be1a9712754832bb97b3797851cdb24842d
|
[
"BSD-2-Clause"
] | null | null | null |
"""Fig. 3 from Heitzig & Hiller (2020) Degrees of individual and groupwise
backward and forward responsibility in extensive-form games with ambiguity,
and their application to social choice problems. ArXiv:2007.07352
drsc_fig3:
v1: i
dont_hesitatew3: lives
hesitatev2: i
try_after_alldelayed_try
succeedw4: lives
failw6: dies
pass_w5: dies
Situation related to the Independence of Nested Decisions (IND) axiom. The agent
sees someone having a heart attack and may either try to rescue them without
hesitation, applying CPU until the ambulance arrives, or hesitate and then
reconsider and try rescuing them after all, in which case it is ambiguous
whether the attempt can still succeed.
"""
from ..__init__ import *
global_players("i")
global_actions("hesitate", "dont_hesitate", "try_after_all", "pass_")
lives = Ou("lives", ac=True)
dies = Ou("dies", ac=False)
T = Tree("drsc_fig3", ro=DeN("v1", pl=i, co={
dont_hesitate: OuN("w3", ou=lives),
hesitate: DeN("v2", pl=i, co={
try_after_all: PoN("delayed_try", su={
("succeed", OuN("w4", ou=lives)),
("fail", OuN("w6", ou=dies))
}),
pass_: OuN("w5", ou=dies)
})
})
)
T.make_globals()
| 30.108696
| 81
| 0.608664
|
19ad8e362fd7bad525b8a921fc18f92df7f7282b
| 82
|
py
|
Python
|
www/speed/benchmarks/fib.py
|
raspberrypieman/brython
|
2cc23d1da6acda604d4a56b4c9d464eb7e374eda
|
[
"BSD-3-Clause"
] | 5,926
|
2015-01-01T07:45:08.000Z
|
2022-03-31T12:34:38.000Z
|
www/speed/benchmarks/fib.py
|
raspberrypieman/brython
|
2cc23d1da6acda604d4a56b4c9d464eb7e374eda
|
[
"BSD-3-Clause"
] | 1,728
|
2015-01-01T01:09:12.000Z
|
2022-03-30T23:25:22.000Z
|
www/speed/benchmarks/fib.py
|
raspberrypieman/brython
|
2cc23d1da6acda604d4a56b4c9d464eb7e374eda
|
[
"BSD-3-Clause"
] | 574
|
2015-01-02T01:36:10.000Z
|
2022-03-26T10:18:48.000Z
|
fib(30)
| 11.714286
| 30
| 0.47561
|
19b063208b212cda110697a8227b09dc8f98a0db
| 414
|
py
|
Python
|
catalog/bindings/csw/role.py
|
NIVANorge/s-enda-playground
|
56ae0a8978f0ba8a5546330786c882c31e17757a
|
[
"Apache-2.0"
] | null | null | null |
catalog/bindings/csw/role.py
|
NIVANorge/s-enda-playground
|
56ae0a8978f0ba8a5546330786c882c31e17757a
|
[
"Apache-2.0"
] | null | null | null |
catalog/bindings/csw/role.py
|
NIVANorge/s-enda-playground
|
56ae0a8978f0ba8a5546330786c882c31e17757a
|
[
"Apache-2.0"
] | null | null | null |
from dataclasses import dataclass
from bindings.csw.code_type_1 import CodeType1
__NAMESPACE__ = "http://www.opengis.net/ows"
| 24.352941
| 65
| 0.724638
|
5fd5ed7c8159f71250918b127471e85178346d85
| 31
|
py
|
Python
|
utils_folder/__init__.py
|
codevideo/Airsim_Test
|
0b47665c67ba674d277fc8de58739a59648bb7eb
|
[
"MIT"
] | null | null | null |
utils_folder/__init__.py
|
codevideo/Airsim_Test
|
0b47665c67ba674d277fc8de58739a59648bb7eb
|
[
"MIT"
] | null | null | null |
utils_folder/__init__.py
|
codevideo/Airsim_Test
|
0b47665c67ba674d277fc8de58739a59648bb7eb
|
[
"MIT"
] | null | null | null |
from .image_generator import *
| 15.5
| 30
| 0.806452
|
5fd63dd37aacbace93081d1f24365379814ddc62
| 1,847
|
py
|
Python
|
discogstagger/lyrics.py
|
makzyt4/discogs-tagger
|
b578257922230b634d43349f2efd4fda72fdd008
|
[
"MIT"
] | 2
|
2019-09-05T04:26:20.000Z
|
2020-08-05T02:56:04.000Z
|
discogstagger/lyrics.py
|
makzyt4/discogs-tagger
|
b578257922230b634d43349f2efd4fda72fdd008
|
[
"MIT"
] | null | null | null |
discogstagger/lyrics.py
|
makzyt4/discogs-tagger
|
b578257922230b634d43349f2efd4fda72fdd008
|
[
"MIT"
] | 1
|
2019-10-02T13:07:34.000Z
|
2019-10-02T13:07:34.000Z
|
import warnings
import urllib
warnings.filterwarnings("ignore", category=UserWarning)
from fuzzywuzzy import fuzz
from bs4 import BeautifulSoup
from discogstagger.crawler import WebCrawler
| 35.519231
| 74
| 0.593936
|
5fd72d6c14585afca0b8d98d7d4aed63853fc97b
| 1,478
|
py
|
Python
|
policy_sentry/util/conditions.py
|
patricksanders/policy_sentry
|
3559ce8d3a19728b4f64dfff4cbdf075e7629b39
|
[
"MIT"
] | null | null | null |
policy_sentry/util/conditions.py
|
patricksanders/policy_sentry
|
3559ce8d3a19728b4f64dfff4cbdf075e7629b39
|
[
"MIT"
] | 20
|
2020-03-20T06:13:09.000Z
|
2022-02-10T18:15:35.000Z
|
policy_sentry/util/conditions.py
|
ssmbct-netops/policy_sentry
|
c9f4752c633fe229220b7f476aa766ea65330489
|
[
"MIT"
] | null | null | null |
"""
Just some text transformation functions related to our
conditions-related workarounds
"""
# Borrowed from parliament. Altered with normalization for lowercase.
def translate_condition_key_data_types(condition_str):
"""
The docs use different type names, so this standardizes them.
Example: The condition secretsmanager:RecoveryWindowInDays is listed as using a "Long"
So return "Number"
"""
if condition_str.lower() in ["arn", "arn"]:
return "Arn"
elif condition_str.lower() in ["bool", "boolean"]:
return "Bool"
elif condition_str.lower() in ["date"]:
return "Date"
elif condition_str.lower() in ["long", "numeric"]:
return "Number"
elif condition_str.lower() in ["string", "string", "arrayofstring"]:
return "String"
elif condition_str.lower() in ["ip"]:
return "Ip"
else:
raise Exception("Unknown data format: {}".format(str))
def get_service_from_condition_key(condition_key):
"""Given a condition key, return the service prefix"""
elements = condition_key.split(":", 2)
return elements[0]
def get_comma_separated_condition_keys(condition_keys):
"""
:param condition_keys: String containing multiple condition keys, separated by double spaces
:return: result: String containing multiple condition keys, comma-separated
"""
result = condition_keys.replace(" ", ",") # replace the double spaces with a comma
return result
| 32.844444
| 96
| 0.688769
|
5fd7391d4fbb21e69c15f5d957bc435fc6d49a18
| 7,798
|
py
|
Python
|
env/lib/python3.7/site-packages/cleo/inputs/argv_input.py
|
Kolawole39/masonite-guides-tutorial
|
9a21cc635291a42f0722f69925be1809bb20e01c
|
[
"MIT"
] | null | null | null |
env/lib/python3.7/site-packages/cleo/inputs/argv_input.py
|
Kolawole39/masonite-guides-tutorial
|
9a21cc635291a42f0722f69925be1809bb20e01c
|
[
"MIT"
] | null | null | null |
env/lib/python3.7/site-packages/cleo/inputs/argv_input.py
|
Kolawole39/masonite-guides-tutorial
|
9a21cc635291a42f0722f69925be1809bb20e01c
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
import sys
import re
from .input import Input
from ..exceptions import NoSuchOption, BadOptionUsage, TooManyArguments
| 33.467811
| 115
| 0.530649
|
5fd7b9ebd6a6a68297eb56bfd50e24457d0aa02b
| 1,528
|
py
|
Python
|
general/email-sender/email_sender.py
|
caesarcc/python-code-tutorials
|
aa48ebe695e86440b206b641501ad55d021309bf
|
[
"MIT"
] | 1,059
|
2019-08-04T17:51:43.000Z
|
2022-03-31T10:13:37.000Z
|
general/email-sender/email_sender.py
|
kylearrigoni/pythoncode-tutorials
|
6fd30ed854d1ea7573351ddb10c1eaae55ca5717
|
[
"MIT"
] | 56
|
2019-12-10T16:46:40.000Z
|
2022-03-29T01:36:50.000Z
|
general/email-sender/email_sender.py
|
kylearrigoni/pythoncode-tutorials
|
6fd30ed854d1ea7573351ddb10c1eaae55ca5717
|
[
"MIT"
] | 1,330
|
2019-08-16T01:36:18.000Z
|
2022-03-31T16:57:22.000Z
|
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from bs4 import BeautifulSoup as bs
# your credentials
email = "email@example.com"
password = "password"
# the sender's email
FROM = "email@example.com"
# the receiver's email
TO = "to@example.com"
# the subject of the email (subject)
subject = "Just a subject"
# initialize the message we wanna send
msg = MIMEMultipart("alternative")
# set the sender's email
msg["From"] = FROM
# set the receiver's email
msg["To"] = TO
# set the subject
msg["Subject"] = subject
# set the body of the email as HTML
html = """
This email is sent using <b>Python </b>!
"""
# uncomment below line if you want to use the HTML template
# located in mail.html
# html = open("mail.html").read()
# make the text version of the HTML
text = bs(html, "html.parser").text
text_part = MIMEText(text, "plain")
html_part = MIMEText(html, "html")
# attach the email body to the mail message
# attach the plain text version first
msg.attach(text_part)
msg.attach(html_part)
# send the mail
send_mail(email, password, FROM, TO, msg)
| 27.781818
| 67
| 0.716623
|
5fd809b863e1c38e1b5883293cb0d69f18e7c0cd
| 140
|
py
|
Python
|
src/app/models/__init__.py
|
starlite-api/backend-starlite-postgres
|
c2d539d88dd13cbe06fa49ab95c1fd6eb398b051
|
[
"MIT"
] | 3
|
2022-01-18T16:35:12.000Z
|
2022-01-25T14:55:32.000Z
|
src/app/models/__init__.py
|
starlite-api/backend-starlite-postgres
|
c2d539d88dd13cbe06fa49ab95c1fd6eb398b051
|
[
"MIT"
] | 1
|
2022-01-24T22:37:35.000Z
|
2022-01-25T08:09:19.000Z
|
src/app/models/__init__.py
|
starlite-api/backend-starlite-postgres
|
c2d539d88dd13cbe06fa49ab95c1fd6eb398b051
|
[
"MIT"
] | null | null | null |
# flake8: noqa
from .base import Base
from .item import Item, ItemCreateModel, ItemModel
from .user import User, UserCreateModel, UserModel
| 28
| 50
| 0.8
|
5fda0bec3ea02ea3a6f8218190306677fcc6bbb6
| 3,371
|
py
|
Python
|
digibanner.py
|
w4mhi/digipi
|
1fb00450cf9ed14a30c293e744848a7cad09f489
|
[
"MIT"
] | null | null | null |
digibanner.py
|
w4mhi/digipi
|
1fb00450cf9ed14a30c293e744848a7cad09f489
|
[
"MIT"
] | null | null | null |
digibanner.py
|
w4mhi/digipi
|
1fb00450cf9ed14a30c293e744848a7cad09f489
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python3
# direwatch
"""
Craig Lamparter KM6LYW, 2021, MIT License
modified by W4MHI February 2022
- see the init_display.py module for display settings
- see https://www.delftstack.com/howto/python/get-ip-address-python/ for the ip address
"""
import sys
import argparse
import time
from netifaces import interfaces, ifaddresses, AF_INET
sys.path.insert(0, '/home/pi/common')
from display_util import *
from constants import *
args = parse_arguments()
if args["fontsize"]:
fontsize = int(args["fontsize"])
if fontsize > 34:
print("The input: " + str(fontsize) + " is greater than: 34 that is maximum value supported.")
print("Setting to maximum value: 34.")
fontsize = 34
elif fontsize < 20:
print("The input: " + str(fontsize) + " is lower than: 20 that is minimum value supported.")
print("Setting to minimum value: 20.")
fontsize = 20
else:
print("Setting font size to default value: 24.")
fontsize = 24
if args["big"]:
message_big = args["big"]
else:
message_big = "DigiPi"
if args["small"]:
message_small = args["small"]
else:
message_small = "DigiPi Operational!"
# title
font_title = get_titlefont()
# define writing fonts
font_message = get_writingfont(fontsize)
spacing = get_spacing(fontsize)
last_line = get_lastline(fontsize)
# Draw a black filled box to clear the image.
draw.rectangle((0, 0, width, height), outline=0, fill="#000000")
# title bar
draw.rectangle((0, 0, width, TITLE_BAR_H), outline=0, fill="#333333")
draw.text((10, 0) , TITLE, font=font_title, fill="#888888")
# ip addresses message
count = 1
draw.text((PAD_LEFT, count*spacing), "Net's IP Addresses", font=font_message, fill="#00FF00")
first_pass = True
ip_present = False
while ip_present == False:
count = 1
# ip addresses
for ifaceName in interfaces():
for i in ifaddresses(ifaceName).setdefault(AF_INET, [{'addr':'No IP yet'}]):
if ifaceName.startswith("wlan") or ifaceName.startswith("eth"):
# increment for interface name
count = count + 1
if first_pass:
# show the interface name
draw.text((PAD_LEFT, count*spacing), "[" + ifaceName + "]", font=font_message, fill="#00FF00")
# increment for the ip address
count = count + 1
#delete the previous line if exists
draw.rectangle((0, count*spacing, width, (count+1)*spacing), outline=0, fill="#000000")
draw.text((4*PAD_LEFT, count*spacing), i['addr'], font=font_message, fill="#00FF00")
if i['addr'].startswith('No IP') == False:
ip_present = True
disp.image(image)
first_pass = False
# wait and re-iterate if no ip address
if ip_present == False:
time.sleep(3)
# message
count = count + 1
if last_line >= count:
draw.text((PAD_LEFT, last_line*spacing), message_small, font=font_message, fill="#FFFF00")
#with display_lock:
disp.image(image)
print("DigiPi operational!\n")
exit(0)
| 29.570175
| 110
| 0.664195
|
5fdb29602cc883d0c3c33fa3a91c2d4157fe4739
| 7,007
|
py
|
Python
|
autotorrent/utils.py
|
jyggen/autotorrent
|
5a8f2b40ccc8c66c73dc520f98b886d21e163afa
|
[
"MIT"
] | 278
|
2015-02-12T19:19:53.000Z
|
2022-03-22T21:17:28.000Z
|
autotorrent/utils.py
|
jyggen/autotorrent
|
5a8f2b40ccc8c66c73dc520f98b886d21e163afa
|
[
"MIT"
] | 56
|
2015-03-27T00:38:37.000Z
|
2022-03-26T17:52:58.000Z
|
autotorrent/utils.py
|
jyggen/autotorrent
|
5a8f2b40ccc8c66c73dc520f98b886d21e163afa
|
[
"MIT"
] | 48
|
2015-03-10T16:50:19.000Z
|
2022-03-20T12:11:50.000Z
|
from __future__ import division
import hashlib
import logging
import os
import re
__all__ = [
'is_unsplitable',
'get_root_of_unsplitable',
'Pieces',
]
UNSPLITABLE_FILE_EXTENSIONS = [
set(['.rar', '.sfv']),
set(['.mp3', '.sfv']),
set(['.vob', '.ifo']),
]
logger = logging.getLogger(__name__)
def is_unsplitable(files):
"""
Checks if a list of files can be considered unsplitable, e.g. VOB/IFO or scene release.
This means the files can only be used in this combination.
"""
extensions = set(os.path.splitext(f)[1].lower() for f in files)
found_unsplitable_extensions = False
for exts in UNSPLITABLE_FILE_EXTENSIONS:
if len(extensions & exts) == len(exts):
found_unsplitable_extensions = True
break
lowercased_files = set([f.lower() for f in files])
found_magic_file = False
if 'movieobject.bdmv' in lowercased_files:
found_magic_file = True
return found_unsplitable_extensions or found_magic_file
def get_root_of_unsplitable(path):
"""
Scans a path for the actual scene release name, e.g. skipping cd1 folders.
Returns None if no scene folder could be found
"""
path = path[::-1]
for p in path:
if not p:
continue
if re.match(r'^(cd[1-9])|(samples?)|(proofs?)|((vob)?sub(title)?s?)$', p, re.IGNORECASE): # scene paths
continue
if re.match(r'^(bdmv)|(disc\d*)|(video_ts)$', p, re.IGNORECASE): # bluray / dd
continue
return p
| 38.927778
| 154
| 0.572285
|
5fdbaa30fa591b9ff594e38b62a435e122fd9e26
| 232
|
py
|
Python
|
Documentation/matplotlib/users/tight_layout_guide-11.py
|
leesavide/pythonista-docs-deprecated
|
9ec3363f07e328bde0a58738a16907f11dfd06e1
|
[
"Apache-2.0"
] | 16
|
2016-06-14T19:45:35.000Z
|
2020-11-30T19:02:58.000Z
|
Documentation/matplotlib/users/tight_layout_guide-11.py
|
leesavide/pythonista-docs
|
9ec3363f07e328bde0a58738a16907f11dfd06e1
|
[
"Apache-2.0"
] | 1
|
2016-06-15T07:10:27.000Z
|
2016-06-15T07:10:27.000Z
|
Documentation/matplotlib/users/tight_layout_guide-11.py
|
leesavide/pythonista-docs
|
9ec3363f07e328bde0a58738a16907f11dfd06e1
|
[
"Apache-2.0"
] | null | null | null |
gs2 = gridspec.GridSpec(3, 1)
for ss in gs2:
ax = fig.add_subplot(ss)
example_plot(ax)
ax.set_title("")
ax.set_xlabel("")
ax.set_xlabel("x-label", fontsize=12)
gs2.tight_layout(fig, rect=[0.5, 0, 1, 1], h_pad=0.5)
| 21.090909
| 53
| 0.637931
|
5fdde3756ec64880272edcdfd80736c9d7a32118
| 5,679
|
py
|
Python
|
FaceRec/dataset.py
|
JasonLee/FaceRecognitionInLowResolutionVideos
|
719ef88ddfbed9d5d40df2480b6e9a197febc1b7
|
[
"MIT"
] | 2
|
2020-07-13T06:00:36.000Z
|
2021-04-15T06:12:16.000Z
|
FaceRec/dataset.py
|
JasonLee/FaceRecognitionInLowResolutionVideos
|
719ef88ddfbed9d5d40df2480b6e9a197febc1b7
|
[
"MIT"
] | 3
|
2020-05-15T04:49:28.000Z
|
2022-01-13T02:47:26.000Z
|
FaceRec/dataset.py
|
JasonLee/FaceRecognitionInLowResolutionVideos
|
719ef88ddfbed9d5d40df2480b6e9a197febc1b7
|
[
"MIT"
] | null | null | null |
from __future__ import print_function, division
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import random
import model
from torch.autograd import Variable
| 39.713287
| 121
| 0.585138
|
5fde36f357f3d09233e7473cce22e0c33f10115a
| 5,203
|
py
|
Python
|
scripts/posts.py
|
flashreads/mediumish-theme-jekyll
|
428e3338c00a3aee9fde119f0885496edd082f12
|
[
"MIT"
] | null | null | null |
scripts/posts.py
|
flashreads/mediumish-theme-jekyll
|
428e3338c00a3aee9fde119f0885496edd082f12
|
[
"MIT"
] | null | null | null |
scripts/posts.py
|
flashreads/mediumish-theme-jekyll
|
428e3338c00a3aee9fde119f0885496edd082f12
|
[
"MIT"
] | null | null | null |
from argparse import ArgumentParser
from datetime import datetime
from os import path, listdir, getcwd, chdir
import subprocess
from dateutil.parser import parse as dt_parse
from ruamel.yaml import YAML
if __name__ == '__main__':
parser = ArgumentParser(description='Transform the FlashReads posts to Jekyll-style MD posts.')
parser.add_argument('-s', '--source', type=str, dest='src_dir', help='The source directory where the flash-reads posts are contained.')
parser.add_argument('-d', '--dest', type=str, dest='dest_dir', help='The destination directory where the Jekyll-style posts will reside - usually <repo>/_posts.')
parser.add_argument('-f', '--featured', type=str, dest='featured_path', help='File containing the featured posts by id, separated by a comma.')
args = parser.parse_args()
transform_posts(args.src_dir, args.dest_dir, args.featured_path)
| 32.51875
| 166
| 0.617528
|
5fe3ceaa4d994eb74303ce409f0c500eac7328b4
| 4,262
|
py
|
Python
|
gelweb/gel2clin/views.py
|
moka-guys/GeL2MDT
|
09bf25b8452e2e887dbf74b1cd4771d234c6166c
|
[
"MIT"
] | null | null | null |
gelweb/gel2clin/views.py
|
moka-guys/GeL2MDT
|
09bf25b8452e2e887dbf74b1cd4771d234c6166c
|
[
"MIT"
] | 1
|
2020-02-06T13:17:40.000Z
|
2020-02-06T13:17:40.000Z
|
gelweb/gel2clin/views.py
|
byronmews/GeL2MDT
|
1449831f0d7c570b71e7f46fb4dd1fcb805b0325
|
[
"MIT"
] | null | null | null |
"""Copyright (c) 2018 Great Ormond Street Hospital for Children NHS Foundation
Trust & Birmingham Women's and Children's NHS Foundation Trust
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, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""
from django.shortcuts import render
from django.shortcuts import render, redirect
from . import *
from gel2mdt.models import *
from gel2mdt.config import load_config
from django.contrib.auth.decorators import login_required
from .forms import ProbandCancerForm
from django.contrib import messages
| 45.827957
| 106
| 0.644533
|
5fe6da3d5fdab2a2eb9fd6fc794811538cea5b7c
| 639
|
py
|
Python
|
lib/clock.py
|
greymistcube/racing_game_ai
|
7e5e6ec781eb3c98729d370cbcc0ab6ed053962f
|
[
"MIT"
] | null | null | null |
lib/clock.py
|
greymistcube/racing_game_ai
|
7e5e6ec781eb3c98729d370cbcc0ab6ed053962f
|
[
"MIT"
] | null | null | null |
lib/clock.py
|
greymistcube/racing_game_ai
|
7e5e6ec781eb3c98729d370cbcc0ab6ed053962f
|
[
"MIT"
] | null | null | null |
import pygame
import lib.common as common
# initializing module
pygame.init()
| 22.034483
| 62
| 0.621283
|
5fe6e8bc747c5f980ad7fbb164a7c5c2ef4b9edf
| 231
|
py
|
Python
|
setup.py
|
powerd4/SNA_project
|
458dae1df4d198f6ce82062cd2e59f8408cbb3cf
|
[
"FTL"
] | null | null | null |
setup.py
|
powerd4/SNA_project
|
458dae1df4d198f6ce82062cd2e59f8408cbb3cf
|
[
"FTL"
] | null | null | null |
setup.py
|
powerd4/SNA_project
|
458dae1df4d198f6ce82062cd2e59f8408cbb3cf
|
[
"FTL"
] | null | null | null |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Social Network Analysis module group project 2020',
author='Dean Power',
license='',
)
| 21
| 68
| 0.679654
|
5fe74a248465ad5e98c9c5e8a0c0fa8593134941
| 994
|
py
|
Python
|
jigu/core/bank.py
|
bongtrop/jigu
|
448bce8ce693f3f7c530bea0f2f268e22100937a
|
[
"MIT"
] | 14
|
2020-03-03T06:46:39.000Z
|
2021-05-01T15:29:35.000Z
|
jigu/core/bank.py
|
bongtrop/jigu
|
448bce8ce693f3f7c530bea0f2f268e22100937a
|
[
"MIT"
] | 9
|
2020-03-09T06:36:30.000Z
|
2021-02-15T14:40:48.000Z
|
jigu/core/bank.py
|
bongtrop/jigu
|
448bce8ce693f3f7c530bea0f2f268e22100937a
|
[
"MIT"
] | 5
|
2020-05-30T22:38:34.000Z
|
2021-02-11T00:56:20.000Z
|
from __future__ import annotations
from jigu.core import AccAddress, Coins
from jigu.util.serdes import JsonDeserializable, JsonSerializable
from jigu.util.validation import Schemas as S
from jigu.util.validation import validate_acc_address
__all__ = ["Input", "Output"]
| 30.121212
| 81
| 0.719316
|
5feabd6e1aae4b67ada18a6e640a09f3df166ffa
| 85
|
py
|
Python
|
hwtLib/mem/__init__.py
|
optical-o/hwtLib
|
edad621f5ad4cdbea20a5751ff4468979afe2f77
|
[
"MIT"
] | 24
|
2017-02-23T10:00:50.000Z
|
2022-01-28T12:20:21.000Z
|
hwtLib/mem/__init__.py
|
optical-o/hwtLib
|
edad621f5ad4cdbea20a5751ff4468979afe2f77
|
[
"MIT"
] | 32
|
2017-04-28T10:29:34.000Z
|
2021-04-27T09:16:43.000Z
|
hwtLib/mem/__init__.py
|
optical-o/hwtLib
|
edad621f5ad4cdbea20a5751ff4468979afe2f77
|
[
"MIT"
] | 8
|
2019-09-19T03:34:36.000Z
|
2022-01-21T06:56:58.000Z
|
"""
A package dedicated to a memory related components, interfaces and utilities.
"""
| 28.333333
| 77
| 0.764706
|
5fead45ea3ba403eb9b2c9548ef8cb56dd3f5f96
| 1,121
|
py
|
Python
|
binary_tree/vertical_order_traversal.py
|
x899/algorithms
|
38a5de72db14ef2664489da9857b598d24c4e276
|
[
"MIT"
] | 472
|
2018-05-25T06:45:44.000Z
|
2020-01-06T15:46:09.000Z
|
binary_tree/vertical_order_traversal.py
|
pratik-a/algorithms-2
|
241115c64a7518c34f672eb2b851b05f353247f1
|
[
"MIT"
] | 6
|
2020-01-25T22:22:44.000Z
|
2021-06-01T04:53:25.000Z
|
binary_tree/vertical_order_traversal.py
|
pratik-a/algorithms-2
|
241115c64a7518c34f672eb2b851b05f353247f1
|
[
"MIT"
] | 44
|
2019-03-02T07:38:38.000Z
|
2020-01-01T16:05:06.000Z
|
""" Vertical Order Traversal On Binary Tree
"""
from collections import defaultdict
def vertical_order(root):
""" vertical order traversal of binary tree """
hd_map = defaultdict(list)
horizontal_dist = 0
preorder(root, horizontal_dist, hd_map)
for key, value in hd_map.items():
print(f"{key}: {value}")
def main():
""" operational function """
root = Node(2)
root.left = Node(7)
root.left.left = Node(2)
root.left.right = Node(6)
root.left.right.left = Node(5)
root.left.right.right = Node(11)
root.right = Node(5)
root.right.right = Node(9)
root.right.right.left = Node(4)
vertical_order(root)
if __name__ == "__main__":
main()
| 21.557692
| 52
| 0.6405
|
5feaf4c73afb53db46a1e5e5e4652d4a41e6e80e
| 1,452
|
py
|
Python
|
data_preprocessing/load_cifar_ten.py
|
gwenniger/multi-hare
|
fb3f655cbbf4af6ccbfc77d587b8ea2924b300cd
|
[
"Apache-2.0"
] | 7
|
2019-12-04T05:58:40.000Z
|
2021-08-04T07:19:55.000Z
|
data_preprocessing/load_cifar_ten.py
|
gwenniger/multi-hare
|
fb3f655cbbf4af6ccbfc77d587b8ea2924b300cd
|
[
"Apache-2.0"
] | null | null | null |
data_preprocessing/load_cifar_ten.py
|
gwenniger/multi-hare
|
fb3f655cbbf4af6ccbfc77d587b8ea2924b300cd
|
[
"Apache-2.0"
] | 4
|
2019-12-03T23:42:00.000Z
|
2020-12-19T19:48:04.000Z
|
import torchvision.transforms as transforms
import torch
import torchvision
__author__ = "Dublin City University"
__copyright__ = "Copyright 2019, Dublin City University"
__credits__ = ["Gideon Maillette de Buy Wenniger"]
__license__ = "Dublin City University Software License (enclosed)"
| 37.230769
| 86
| 0.637741
|
5feb07c430256fe7dba892fc904f0cd15150fcbf
| 1,018
|
py
|
Python
|
dprofiler/profile.py
|
disktnk/dprofiler
|
be820de440c21d3fef711db1220bfddb9bdee177
|
[
"MIT"
] | null | null | null |
dprofiler/profile.py
|
disktnk/dprofiler
|
be820de440c21d3fef711db1220bfddb9bdee177
|
[
"MIT"
] | 3
|
2018-10-16T04:03:50.000Z
|
2018-10-17T01:34:16.000Z
|
dprofiler/profile.py
|
disktnk/dprofiler
|
be820de440c21d3fef711db1220bfddb9bdee177
|
[
"MIT"
] | null | null | null |
import cProfile
import functools
import logging
import pstats
import sys
import six
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.DEBUG)
_stream_handler = logging.StreamHandler(sys.stdout)
_stream_handler.setLevel(logging.DEBUG)
_logger.addHandler(_stream_handler)
| 23.674419
| 78
| 0.642436
|
5feb9d3de56d225150681a0ca825ae08aaac3052
| 79
|
py
|
Python
|
helper_funcs/__init__.py
|
mschoder/trajectory_lib
|
c75476c53fa32b3dd69e998996c6e2a6a72b24b4
|
[
"MIT"
] | 1
|
2021-11-04T14:05:45.000Z
|
2021-11-04T14:05:45.000Z
|
helper_funcs/__init__.py
|
mschoder/trajectory_lib
|
c75476c53fa32b3dd69e998996c6e2a6a72b24b4
|
[
"MIT"
] | null | null | null |
helper_funcs/__init__.py
|
mschoder/trajectory_lib
|
c75476c53fa32b3dd69e998996c6e2a6a72b24b4
|
[
"MIT"
] | null | null | null |
import helper_funcs.spline
import helper_funcs.plotter
import helper_funcs.grid
| 26.333333
| 27
| 0.898734
|
5fec5184bee3516b0d2cd771d0ad21b3d6f1997f
| 3,948
|
py
|
Python
|
server.py
|
HusseinKabbout/qwc-document-service
|
c8d856390006e0f5ecc0d28b0d53da55e5505381
|
[
"MIT"
] | null | null | null |
server.py
|
HusseinKabbout/qwc-document-service
|
c8d856390006e0f5ecc0d28b0d53da55e5505381
|
[
"MIT"
] | null | null | null |
server.py
|
HusseinKabbout/qwc-document-service
|
c8d856390006e0f5ecc0d28b0d53da55e5505381
|
[
"MIT"
] | 1
|
2020-04-24T11:36:26.000Z
|
2020-04-24T11:36:26.000Z
|
import os
import sys
from urllib.parse import urlencode
from flask import Flask, Response, abort, request, stream_with_context, jsonify
from flask_restx import Api, Resource, fields, reqparse
import requests
from qwc_services_core.api import CaseInsensitiveArgument
from qwc_services_core.app import app_nocache
from qwc_services_core.auth import auth_manager, optional_auth, get_auth_user
from qwc_services_core.tenant_handler import TenantHandler
from qwc_services_core.runtime_config import RuntimeConfig
from qwc_services_core.permissions_reader import PermissionsReader
# Flask application
app = Flask(__name__)
app_nocache(app)
api = Api(app, version='1.0', title='Document service API',
description="""API for QWC Document service.
The document service delivers reports from the Jasper reporting service.
""",
default_label='Document operations', doc='/api/')
app.config.SWAGGER_UI_DOC_EXPANSION = 'list'
# disable verbose 404 error message
app.config['ERROR_404_HELP'] = False
auth = auth_manager(app, api)
tenant_handler = TenantHandler(app.logger)
config_handler = RuntimeConfig("document", app.logger)
def get_document(tenant, template, format):
"""Return report with specified template and format.
:param str template: Template ID
:param str format: Document format
"""
config = config_handler.tenant_config(tenant)
jasper_service_url = config.get(
'jasper_service_url', 'http://localhost:8002/reports')
jasper_timeout = config.get("jasper_timeout", 60)
resources = config.resources().get('document_templates', [])
permissions_handler = PermissionsReader(tenant, app.logger)
permitted_resources = permissions_handler.resource_permissions(
'document_templates', get_auth_user()
)
if template in permitted_resources:
resource = list(filter(
lambda entry: entry.get("template") == template, resources))
if len(resource) != 1:
app.logger.info("Template '%s' not found in config", template)
abort(404)
jasper_template = resource[0]['report_filename']
# http://localhost:8002/reports/BelasteteStandorte/?format=pdf&p1=v1&..
url = "%s/%s/" % (jasper_service_url, jasper_template)
params = {"format": format}
for k, v in request.args.lists():
params[k] = v
app.logger.info("Forward request to %s?%s" %
(url, urlencode(params)))
response = requests.get(url, params=params, timeout=jasper_timeout)
r = Response(
stream_with_context(response.iter_content(chunk_size=16*1024)),
content_type=response.headers['content-type'],
status=response.status_code)
return r
else:
app.logger.info("Missing permissions for template '%s'", template)
abort(404)
# routes
""" readyness probe endpoint """
""" liveness probe endpoint """
# local webserver
if __name__ == '__main__':
print("Starting GetDocument service...")
app.run(host='localhost', port=5018, debug=True)
| 32.360656
| 79
| 0.680091
|
5fedb1afd0a343dd3c21ad7f3aee3e96bedef35d
| 403
|
py
|
Python
|
scripts/Government Spending.py
|
MarcosDaNight/Dashboard-COVID19
|
26967d2fb7b3dd44c3c51b8ac79608d91bf26d71
|
[
"MIT"
] | null | null | null |
scripts/Government Spending.py
|
MarcosDaNight/Dashboard-COVID19
|
26967d2fb7b3dd44c3c51b8ac79608d91bf26d71
|
[
"MIT"
] | null | null | null |
scripts/Government Spending.py
|
MarcosDaNight/Dashboard-COVID19
|
26967d2fb7b3dd44c3c51b8ac79608d91bf26d71
|
[
"MIT"
] | null | null | null |
from matplotlib import pyplot as plt
# data speding from Federal Government Plan
planes = ['Transferncia para sade', 'FPE e FPM', 'Assistncia Social',
'Suspenso de dvidas da Unio', 'Renegociao com bancos']
spend = [8, 16, 2, 12.6, 9.3]
plt.axis("equal")
plt.pie(spend, labels=planes, autopct='%1.2f%%')
plt.title("Gastos dos Planos Governamentais")
plt.show()
| 22.388889
| 73
| 0.665012
|
5fee310b12b10f820f272b0dba6075da741be40b
| 9,817
|
py
|
Python
|
nexusmaker/tests/test_CognateParser.py
|
SimonGreenhill/NexusMaker
|
12591bd4217bc1ba4477845e524083c2164df91a
|
[
"BSD-3-Clause"
] | null | null | null |
nexusmaker/tests/test_CognateParser.py
|
SimonGreenhill/NexusMaker
|
12591bd4217bc1ba4477845e524083c2164df91a
|
[
"BSD-3-Clause"
] | 2
|
2017-10-12T08:59:51.000Z
|
2021-05-31T00:37:16.000Z
|
nexusmaker/tests/test_CognateParser.py
|
SimonGreenhill/NexusMaker
|
12591bd4217bc1ba4477845e524083c2164df91a
|
[
"BSD-3-Clause"
] | 1
|
2017-10-12T08:59:09.000Z
|
2017-10-12T08:59:09.000Z
|
import unittest
from nexusmaker import CognateParser
| 44.220721
| 88
| 0.581237
|
5ff029ed47a23de0243a31bef9cc5542860e44d1
| 867
|
py
|
Python
|
ngo_point1/ngo_requirements/urls.py
|
Sanayshah2/T046_Scrapshut
|
ecb269373e9b78a738ceb99675379ca21ee313a5
|
[
"MIT"
] | null | null | null |
ngo_point1/ngo_requirements/urls.py
|
Sanayshah2/T046_Scrapshut
|
ecb269373e9b78a738ceb99675379ca21ee313a5
|
[
"MIT"
] | null | null | null |
ngo_point1/ngo_requirements/urls.py
|
Sanayshah2/T046_Scrapshut
|
ecb269373e9b78a738ceb99675379ca21ee313a5
|
[
"MIT"
] | 1
|
2021-04-23T17:06:44.000Z
|
2021-04-23T17:06:44.000Z
|
from django.contrib import admin
from django.urls import path
from . import views
from django.conf.urls import url
urlpatterns = [
path('',views.home,name='home'),
path('register/',views.register,name='register'),
path('login/',views.Login,name='login'),
path('logout/', views.logout_view, name='logout_view'),
path('add-requirement/', views.addRequirement, name='addRequirement'),
path('ngo-dashboard/', views.ngoDashboard, name='ngoDashboard'),
path('ngo-requirement-view/<int:rid>/', views.ngoRequirementView, name='ngoRequirementView'),
path('donor-requirement-view/<int:rid>/', views.donorRequirementView, name='donorRequirementView'),
path('donor-dashboard/', views.donorDashboard, name='donorDashboard'),
path('requirement-fulfillment/<int:rid>/', views.requirement_fulfillment, name='requirement_fulfillment'),
]
| 37.695652
| 110
| 0.726644
|
5ff34356a914a7907c97352a87bdb8eb2ee14f4e
| 32,810
|
py
|
Python
|
parakeet/models/wavenet.py
|
lfchener/Parakeet
|
b0ba6e7bf9b44b6309ca45927d4405bb85fcd103
|
[
"Apache-2.0"
] | 1
|
2021-02-03T12:11:21.000Z
|
2021-02-03T12:11:21.000Z
|
parakeet/models/wavenet.py
|
gzfffff/Parakeet
|
a84b6d3383b2a8a5fb45d0c233bee1ed80d0b389
|
[
"Apache-2.0"
] | null | null | null |
parakeet/models/wavenet.py
|
gzfffff/Parakeet
|
a84b6d3383b2a8a5fb45d0c233bee1ed80d0b389
|
[
"Apache-2.0"
] | null | null | null |
# Copyright (c) 2020 PaddlePaddle 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 applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import math
import time
from typing import Union, Sequence, List
from tqdm import trange
import numpy as np
import paddle
from paddle import nn
from paddle.nn import functional as F
import paddle.fluid.initializer as I
import paddle.fluid.layers.distributions as D
from parakeet.modules.conv import Conv1dCell
from parakeet.modules.audio import quantize, dequantize, STFT
from parakeet.utils import checkpoint, layer_tools
__all__ = ["WaveNet", "ConditionalWaveNet"]
def crop(x, audio_start, audio_length):
"""Crop the upsampled condition to match audio_length.
The upsampled condition has the same time steps as the whole audio does.
But since audios are sliced to 0.5 seconds randomly while conditions are
not, upsampled conditions should also be sliced to extactly match the time
steps of the audio slice.
Parameters
----------
x : Tensor [shape=(B, C, T)]
The upsampled condition.
audio_start : Tensor [shape=(B,), dtype:int]
The index of the starting point of the audio clips.
audio_length : int
The length of the audio clip(number of samples it contaions).
Returns
-------
Tensor [shape=(B, C, audio_length)]
Cropped condition.
"""
# crop audio
slices = [] # for each example
# paddle now supports Tensor of shape [1] in slice
# starts = audio_start.numpy()
for i in range(x.shape[0]):
start = audio_start[i]
end = start + audio_length
slice = paddle.slice(x[i], axes=[1], starts=[start], ends=[end])
slices.append(slice)
out = paddle.stack(slices)
return out
| 33.548057
| 111
| 0.569857
|
5ff3bdba3407ef79de92445150f4e8cf96492395
| 661
|
py
|
Python
|
xmas/util.py
|
drocco007/xmas_pi
|
23d8f7b95ec4682d057b68d4a53e5b0ae3b193fa
|
[
"MIT"
] | null | null | null |
xmas/util.py
|
drocco007/xmas_pi
|
23d8f7b95ec4682d057b68d4a53e5b0ae3b193fa
|
[
"MIT"
] | null | null | null |
xmas/util.py
|
drocco007/xmas_pi
|
23d8f7b95ec4682d057b68d4a53e5b0ae3b193fa
|
[
"MIT"
] | null | null | null |
def normalize(values, gammas):
"""Adjust a list of brightness values according to a list of gamma values.
Given a list of light brightness values from 0.0 to 1.0, adjust the value
according to the corresponding maximum brightness in the gamma list. For
example::
>>> gammas = [0.3, 1.0]
>>> values = [1.0, 1.0]
>>> normalize(values, gammas)
[0.3, 1.0]
>>> values = [0.5, 0.5]
>>> normalize(values, gammas)
[0.15, 0.5]
>>> values = [0.1, 0.0]
>>> normalize(values, gammas)
[0.03, 0.0]
"""
return [value * gamma for value, gamma in zip(values, gammas)]
| 27.541667
| 78
| 0.559758
|
5ff67231767a550306fa1eed298e972631db8363
| 1,407
|
py
|
Python
|
06/TemplateMaching.py
|
mastnk/GCIP
|
1d1ec23388629f145a021efd69797aa18b3891e3
|
[
"MIT"
] | null | null | null |
06/TemplateMaching.py
|
mastnk/GCIP
|
1d1ec23388629f145a021efd69797aa18b3891e3
|
[
"MIT"
] | null | null | null |
06/TemplateMaching.py
|
mastnk/GCIP
|
1d1ec23388629f145a021efd69797aa18b3891e3
|
[
"MIT"
] | null | null | null |
import sys
import cv2 # it is necessary to use cv2 library
import numpy as np
# https://docs.opencv.org/4.5.2/d4/dc6/tutorial_py_template_matching.html
if( __name__ == '__main__' ):
if( len(sys.argv) >= 3 ):
main( sys.argv[1], sys.argv[2] )
else:
print( 'usage: python '+sys.argv[0]+' input_filenname template_filename' )
| 31.977273
| 105
| 0.668088
|
5ff692081eaaca772a3292cf14f5309c58c43958
| 516
|
py
|
Python
|
contest/tenka1-pbc2019/C_Stones.py
|
mola1129/atcoder
|
1d3b18cb92d0ba18c41172f49bfcd0dd8d29f9db
|
[
"MIT"
] | null | null | null |
contest/tenka1-pbc2019/C_Stones.py
|
mola1129/atcoder
|
1d3b18cb92d0ba18c41172f49bfcd0dd8d29f9db
|
[
"MIT"
] | null | null | null |
contest/tenka1-pbc2019/C_Stones.py
|
mola1129/atcoder
|
1d3b18cb92d0ba18c41172f49bfcd0dd8d29f9db
|
[
"MIT"
] | null | null | null |
n = int(input())
s = input()
bcnt = [0]*n
wcnt = [0]*n
result = 2 * 10 ** 5
#
if s[0] == "#":
bcnt[0] = 1
if s[n-1] == ".":
wcnt[n-1] = 1
for i in range(1,n):
bcnt[i] = bcnt[i-1]
if s[i] == "#":
bcnt[i] += 1
for i in range(n-2,-1,-1):
wcnt[i] = wcnt[i+1]
if s[i] == ".":
wcnt[i] += 1
#
for i in range(0,n-1):
result = min(bcnt[i] + wcnt[i+1],result)
result = min(result,bcnt[n-1])
result = min(result,wcnt[0])
print(result)
| 17.2
| 45
| 0.45155
|
5ff9658511513524516ba459b859ca485a53d2a3
| 9,413
|
py
|
Python
|
scripts/myclient.py
|
Anant16/Networks_Project
|
a0f15bde4b2625a5ffe382da958f04d4538d23d2
|
[
"MIT"
] | null | null | null |
scripts/myclient.py
|
Anant16/Networks_Project
|
a0f15bde4b2625a5ffe382da958f04d4538d23d2
|
[
"MIT"
] | null | null | null |
scripts/myclient.py
|
Anant16/Networks_Project
|
a0f15bde4b2625a5ffe382da958f04d4538d23d2
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
"""Script for Tkinter GUI chat client."""
from socket import AF_INET, socket, SOCK_STREAM
from threading import Thread
import tkinter
from tkinter import filedialog, Tk
import os
import time
def private_receive(pmsg_list, pclient_socket):
"""Handles receiving of messages."""
# pmsg_list = ptop.messages_frame.msg_list
while True:
try:
msg = pclient_socket.recv(BUFSIZ)
if msg == bytes("{file}", "utf8"):
pmsg_list.insert(tkinter.END, "Receiving File")
fname, fsize = private_recv_file(pclient_socket)
pmsg_list.insert(tkinter.END, "File Recieved")
elif msg == bytes("{quit}", "utf8"):
break
else:
msg = msg.decode('utf8')
pmsg_list.insert(tkinter.END, msg)
except OSError: # Possibly client has left the chat.
break
def receive():
"""Handles receiving of messages."""
buttons_frame = tkinter.Frame(top)
while True:
try:
msg = client_socket.recv(BUFSIZ).decode("utf8")
# print(msg)
if msg == '{quit}':
break
elif '{prequest}' in msg[0:12]:
name = msg[11:]
handle_connection_request(name)
elif '{name}' in msg[0:6]:
print(msg)
uname.insert(tkinter.END, msg[7:])
elif '{namelist}' in msg[0:12]:
nlist = msg.split('_')[1]
name_list = nlist.split(',')[1:]
print(name_list)
buttons_frame.destroy()
buttons_frame = tkinter.Frame(top)
for name in name_list:
private_button = tkinter.Button(buttons_frame, text=name, command=lambda user=name: create_private(user))
private_button.pack(side=tkinter.LEFT)
buttons_frame.pack(side=tkinter.LEFT)
else:
msg_list.insert(tkinter.END, msg)
except OSError: # Possibly client has left the chat.
break
def private_send(client_socket_no, pmy_msg, pmsg_list, event=None): # event is passed by binders.
"""Handles sending of messages."""
print("socket")
print(client_socket_no)
print(pmy_msg)
print(pmsg_list)
msg = pmy_msg.get()
pmy_msg.delete(0, 100) # Clears input field.
print("message sent is: " + msg)
try:
client_socket_no.send(bytes(msg, "utf8"))
except BrokenPipeError:
error_msg = "Unable to send"
pmsg_list.insert(tkinter.END, error_msg)
if msg == "{quit}":
client_socket_no.close()
top.quit()
def send(event=None): # event is passed by binders.
"""Handles sending of messages."""
print("socket")
print(client_socket)
msg = my_msg.get()
my_msg.set("") # Clears input field.
try:
client_socket.send(bytes(msg, "utf8"))
except BrokenPipeError:
error_msg = "Unable to send"
msg_list.insert(tkinter.END, error_msg)
if msg == "{quit}":
client_socket.close()
top.quit()
# def on_closing(event=None):
# """This function is to be called when the window is closed."""
# my_msg.set("{quit}")
# try:
# send()
# except BrokenPipeError:
# print("BrokenPipeError")
# top.quit()
#----Now comes the sockets part----
HOST = input('Enter host: ')
PORT = input('Enter port: ')
if not PORT:
PORT = 35000
else:
PORT = int(PORT)
if not HOST:
HOST = '127.0.0.1'
BUFSIZ = 1024
ADDR = (HOST, PORT)
client_socket = socket(AF_INET, SOCK_STREAM)
client_socket.connect(ADDR)
top = tkinter.Tk()
top.title("Group Chat")
uname = tkinter.Text(top)
# uname.pack()
messages_frame = tkinter.Frame(top)
my_msg = tkinter.StringVar() # For the messages to be sent.
# my_msg.set("Type your messages here.")
scrollbar = tkinter.Scrollbar(messages_frame) # To navigate through past messages.
# Following will contain the messages.
msg_list = tkinter.Listbox(messages_frame, height=15, width=50, yscrollcommand=scrollbar.set)
scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
msg_list.pack(side=tkinter.LEFT, fill=tkinter.BOTH)
msg_list.pack()
messages_frame.pack()
entry_field = tkinter.Entry(top, textvariable=my_msg)
entry_field.bind("<Return>", send)
entry_field.pack()
send_button = tkinter.Button(top, text="Send", command=send)
send_button.pack()
send_file_button = tkinter.Button(top, text="Send File", command=send_file)
send_file_button.pack()
# top.protocol("WM_DELETE_WINDOW", on_closing)
# #----Now comes the sockets part----
# HOST = input('Enter host: ')
# PORT = input('Enter port: ')
# if not PORT:
# PORT = 33000
# else:
# PORT = int(PORT)
# BUFSIZ = 1024
# ADDR = (HOST, PORT)
# client_socket = socket(AF_INET, SOCK_STREAM)
# client_socket.connect(ADDR)
receive_thread = Thread(target=receive)
receive_thread.start()
top.mainloop() # Starts GUI execution.
| 31.272425
| 125
| 0.627961
|
5ffb47974af4fe5ac023573e2b360b56ebf1ffbc
| 1,689
|
py
|
Python
|
issues/i10_parent.py
|
Raph-xyz/wexpect
|
c1e81b3a69d4d3821cb01b61bd5297b51a24539f
|
[
"MIT"
] | 52
|
2019-04-24T14:38:43.000Z
|
2022-03-08T22:03:11.000Z
|
issues/i10_parent.py
|
Raph-xyz/wexpect
|
c1e81b3a69d4d3821cb01b61bd5297b51a24539f
|
[
"MIT"
] | 51
|
2019-05-13T12:15:09.000Z
|
2021-12-15T14:00:15.000Z
|
issues/i10_parent.py
|
Raph-xyz/wexpect
|
c1e81b3a69d4d3821cb01b61bd5297b51a24539f
|
[
"MIT"
] | 20
|
2019-07-15T15:48:31.000Z
|
2022-03-27T08:55:17.000Z
|
import wexpect
import time
import sys
import os
here = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, here)
from long_printer import puskas_wiki
print(wexpect.__version__)
# With quotes (C:\Program Files\Python37\python.exe needs quotes)
python_executable = '"' + sys.executable + '" '
child_script = here + '\\long_printer.py'
main()
| 26.390625
| 68
| 0.474837
|
5ffcd7c87c77f89439cef7d88357fcf225e1b8ea
| 3,694
|
py
|
Python
|
sir_sampler.py
|
bveitch/EpidPy
|
455cd67afa2efbb774300115abb5fc7d4600b37d
|
[
"BSD-3-Clause"
] | null | null | null |
sir_sampler.py
|
bveitch/EpidPy
|
455cd67afa2efbb774300115abb5fc7d4600b37d
|
[
"BSD-3-Clause"
] | null | null | null |
sir_sampler.py
|
bveitch/EpidPy
|
455cd67afa2efbb774300115abb5fc7d4600b37d
|
[
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 10:17:51 2020
description : Sampling methods from sir space to data space
author : bveitch
version : 1.0
project : EpidPy (epidemic modelling in python)
Usage:
Data fitting in least squares fit
Also acts on labels for data description and fitting
randSampler: adds random noise/sampling bias to synthetics
"""
import numpy as np;
#def draw_samples(pT,n,Ntests):
# np.random.seed(0)
# s = np.random.normal(0, 1,n)
# mu = Ntests*pT
# sigma = np.sqrt(Ntests*pT*(1-pT))
# data_samp = (sigma*s+mu)/Ntests
# return data_samp
def randSampler(data,pTT,pTF,Ntests):
if(len(data.shape)==1):
n=data.shape[0]
pT=pTT*data+pTF*(1-data)
data_samp=draw_samples(pT,n,Ntests)
return data_samp
else:
[n,m]=data.shape
assert (m == len(pTT)),"data size doesnt match size pTT"
pT=np.zeros(n)
for i in range(m):
pT=pTT[i]*data[:,i]+pTF*(1-np.sum(data,1))
data_samp=draw_samples(pT,n,Ntests)
return data_samp
| 29.790323
| 78
| 0.554413
|
27004bc90d0396548daec8e9a418a7f70ae5efe9
| 4,597
|
py
|
Python
|
database_sanitizer/session.py
|
sharescape/python-database-sanitizer
|
560bf402e3896285980abb21a74d5be8d2da1698
|
[
"MIT"
] | 37
|
2018-05-07T13:07:25.000Z
|
2022-02-07T18:58:10.000Z
|
database_sanitizer/session.py
|
sharescape/python-database-sanitizer
|
560bf402e3896285980abb21a74d5be8d2da1698
|
[
"MIT"
] | 31
|
2018-04-27T13:16:28.000Z
|
2021-12-10T10:08:00.000Z
|
database_sanitizer/session.py
|
sharescape/python-database-sanitizer
|
560bf402e3896285980abb21a74d5be8d2da1698
|
[
"MIT"
] | 15
|
2018-05-04T12:28:12.000Z
|
2022-02-17T09:27:58.000Z
|
"""
API to sanitation session.
Sanitation session allows having a state within a single sanitation
process.
One important thing stored to the session is a secret key which is
generated to a new random value for each sanitation session, but it
stays constant during the whole sanitation process. Its value is never
revealed, so that it is possible to generate such one way hashes with
it, that should not be redoable afterwards. I.e. during the sanitation
session it's possible to do ``hash(C) -> H`` for any clear text C, but
it is not possible to check if H is the hashed value of C after the
sanitation session has ended.
"""
import hashlib
import hmac
import random
import sys
import threading
from six import int2byte
if sys.version_info >= (3, 6):
from typing import Callable, Optional, Sequence # noqa
SECRET_KEY_BITS = 128
_thread_local_storage = threading.local()
def hash_text_to_int(value, bit_length=32):
# type: (str, int) -> int
"""
Hash a text value to an integer.
Generates an integer number based on the hash derived with
`hash_text` from the given text value.
:param bit_length: Number of bits to use from the hash value.
:return: Integer value within ``0 <= result < 2**bit_length``
"""
hash_value = hash_text(value)
return int(hash_value[0:(bit_length // 4)], 16)
def hash_text_to_ints(value, bit_lengths=(16, 16, 16, 16)):
# type: (str, Sequence[int]) -> Sequence[int]
"""
Hash a text value to a sequence of integers.
Generates a sequence of integer values with given bit-lengths
similarly to `hash_text_to_int`, but allowing generating many
separate numbers with a single call.
:param bit_lengths:
Tuple of bit lengths for the resulting integers. Defines also the
length of the result tuple.
:return:
Tuple of ``n`` integers ``(R_1, ... R_n)`` with the requested
bit-lengths ``(L_1, ..., L_n)`` and values ranging within
``0 <= R_i < 2**L_i`` for each ``i``.
"""
hash_value = hash_text(value)
hex_lengths = [x // 4 for x in bit_lengths]
hex_ranges = (
(sum(hex_lengths[0:i]), sum(hex_lengths[0:(i + 1)]))
for i in range(len(hex_lengths)))
return tuple(int(hash_value[a:b], 16) for (a, b) in hex_ranges)
def hash_text(value, hasher=hashlib.sha256, encoding='utf-8'):
# type: (str, Callable, str) -> str
"""
Generate a hash for a text value.
The hash will be generated by encoding the text to bytes with given
encoding and then generating a hash with HMAC using the session
secret as the key and the given hash function.
:param value: Text value to hash
:param hasher: Hash function to use, SHA256 by default
:param encoding: Encoding to use, UTF-8 by default
:return: Hexadecimal presentation of the hash as a string
"""
return hash_bytes(value.encode(encoding), hasher)
def hash_bytes(value, hasher=hashlib.sha256):
# type: (bytes, Callable) -> str
"""
Generate a hash for a bytes value.
The hash will be generated by generating a hash with HMAC using the
session secret as the key and the given hash function.
:param value: Bytes value to hash
:param hasher: Hash function to use.
:return: Hexadecimal presentation of the hash as a string
"""
return hmac.new(get_secret(), value, hasher).hexdigest()
def get_secret():
# type: () -> bytes
"""
Get session specific secret key.
:return: Session key as bytes
"""
if not getattr(_thread_local_storage, 'secret_key', None):
_initialize_session()
return _thread_local_storage.secret_key # type: ignore
def reset(secret_key=None):
# type: (Optional[bytes]) -> None
"""
Reset the session.
By default, this resets the value of the secret to None so that, if
there was an earlier sanitation process ran on the same thread, then
a next call that needs the secret key of the session will generate a
new value for it.
This may also be used to set a predefined value for the secret key.
:param secret_key:
Value to set as the new session secret key or None if a new one
should be generated as soon as one is needed.
"""
_thread_local_storage.secret_key = secret_key
def _initialize_session():
# type: () -> None
"""
Generate a new session key and store it to thread local storage.
"""
sys_random = random.SystemRandom()
_thread_local_storage.secret_key = b''.join(
int2byte(sys_random.randint(0, 255))
for _ in range(SECRET_KEY_BITS // 8))
| 31.272109
| 72
| 0.688057
|
270052ade6542cf9600c8d97910142b209cecc23
| 573
|
py
|
Python
|
ciaa-nxp/pyExamples/Main_Timers_2.py
|
braytac/micropython
|
4fba270b6061395367e7f49eb3baa77365557ace
|
[
"MIT"
] | 2
|
2019-07-28T05:27:42.000Z
|
2020-05-26T04:39:43.000Z
|
ciaa-nxp/pyExamples/Main_Timers_2.py
|
braytac/micropython
|
4fba270b6061395367e7f49eb3baa77365557ace
|
[
"MIT"
] | null | null | null |
ciaa-nxp/pyExamples/Main_Timers_2.py
|
braytac/micropython
|
4fba270b6061395367e7f49eb3baa77365557ace
|
[
"MIT"
] | 1
|
2018-06-23T22:07:06.000Z
|
2018-06-23T22:07:06.000Z
|
import pyb
print("Test Timers")
t1 = pyb.Timer(1)
t2 = pyb.Timer(2)
t1.interval(2000,callb)
t2.timeout(5000,callbTimeout)
t1.freq(1)
print("f t1:"+str(t1.freq()))
t1.period(204000000)
t1.prescaler(3)
print("period t1:"+str(t1.period()))
print("presc t1:"+str(t1.prescaler()))
t1.counter(0)
print("counter t1:"+str(t1.counter()))
print("src freq t1:"+str(t1.source_freq()))
while True:
pyb.delay(100)
#t1.counter(0)
#t1.deinit()
| 14.692308
| 43
| 0.685864
|
2701a91ae74b0da4e98a4cd24af4fe84d580b309
| 17,219
|
py
|
Python
|
tests/test_viewer.py
|
glenvorel/waterfalls
|
900e9fb51a487b7ca1f5ed5274c0bdba95a4d435
|
[
"MIT"
] | 1
|
2020-08-06T03:58:54.000Z
|
2020-08-06T03:58:54.000Z
|
tests/test_viewer.py
|
glenvorel/performancepy
|
900e9fb51a487b7ca1f5ed5274c0bdba95a4d435
|
[
"MIT"
] | null | null | null |
tests/test_viewer.py
|
glenvorel/performancepy
|
900e9fb51a487b7ca1f5ed5274c0bdba95a4d435
|
[
"MIT"
] | null | null | null |
import json
import os
import tempfile
import unittest
from unittest.mock import patch
from waterfalls import Viewer, viewer
if __name__ == "__main__":
unittest.main()
| 34.856275
| 108
| 0.475812
|
2704c694bb778a6cd16b19f2de02eece854903d3
| 4,491
|
py
|
Python
|
reflect/menus.py
|
stefanthaler/daily-reflection
|
2aba4873742b205f75a71b2ce382d126153f14c5
|
[
"MIT"
] | null | null | null |
reflect/menus.py
|
stefanthaler/daily-reflection
|
2aba4873742b205f75a71b2ce382d126153f14c5
|
[
"MIT"
] | null | null | null |
reflect/menus.py
|
stefanthaler/daily-reflection
|
2aba4873742b205f75a71b2ce382d126153f14c5
|
[
"MIT"
] | null | null | null |
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit import PromptSession,prompt,print_formatted_text
from reflect.style import *
import os
from prompt_toolkit.shortcuts import clear
from prompt_toolkit.formatted_text import FormattedText
| 30.760274
| 108
| 0.583389
|
27059812bfb36013c718b5579e1caa2896f39e29
| 636
|
py
|
Python
|
matrix/main.py
|
oleggator/python-advanced
|
0e951fe6e7ae74129536ded5c02a9f1ea3337a7d
|
[
"MIT"
] | null | null | null |
matrix/main.py
|
oleggator/python-advanced
|
0e951fe6e7ae74129536ded5c02a9f1ea3337a7d
|
[
"MIT"
] | 2
|
2019-04-28T20:37:35.000Z
|
2019-10-29T08:11:24.000Z
|
matrix/main.py
|
oleggator/python-advanced
|
0e951fe6e7ae74129536ded5c02a9f1ea3337a7d
|
[
"MIT"
] | null | null | null |
from matrix import Matrix as CMatrix
from py_matrix import PyMatrix
if __name__ == '__main__':
main()
| 21.2
| 76
| 0.550314
|
27085e60eb21632a2fb266c8e1fc048c12001579
| 3,947
|
py
|
Python
|
horizon_telemetry/compute/views.py
|
simonpasquier/horizon-telemetry-dashboard
|
f284ec6ae8b1932079852fe3e9ab4b7a27ff58d7
|
[
"Apache-2.0"
] | null | null | null |
horizon_telemetry/compute/views.py
|
simonpasquier/horizon-telemetry-dashboard
|
f284ec6ae8b1932079852fe3e9ab4b7a27ff58d7
|
[
"Apache-2.0"
] | 2
|
2017-10-10T07:30:41.000Z
|
2017-10-19T18:34:13.000Z
|
horizon_telemetry/compute/views.py
|
simonpasquier/horizon-telemetry-dashboard
|
f284ec6ae8b1932079852fe3e9ab4b7a27ff58d7
|
[
"Apache-2.0"
] | null | null | null |
import datetime
import json
from django.conf import settings
from django.http import HttpResponse
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from horizon import exceptions, tables
from horizon_telemetry.forms import DateForm
from horizon_telemetry.utils.influxdb_client import (get_host_usage_metrics,
get_host_cpu_metric,
get_host_disk_metric,
get_host_memory_metric,
get_host_network_metric)
from openstack_dashboard import api
from . import tables as project_tables
| 36.88785
| 100
| 0.593615
|
270af1960a206b26f220b68d5328bdfbbbe68aa2
| 1,983
|
py
|
Python
|
src/pySanbot/test/test_util/test_boyer_moore_search.py
|
BHFaction/Tribot
|
38d8caaa73775654125db3091b8de2aadb3dba99
|
[
"MIT"
] | 3
|
2017-04-04T04:03:28.000Z
|
2021-05-29T08:08:48.000Z
|
src/pySanbot/test/test_util/test_boyer_moore_search.py
|
BHFaction/Tribot
|
38d8caaa73775654125db3091b8de2aadb3dba99
|
[
"MIT"
] | null | null | null |
src/pySanbot/test/test_util/test_boyer_moore_search.py
|
BHFaction/Tribot
|
38d8caaa73775654125db3091b8de2aadb3dba99
|
[
"MIT"
] | 2
|
2018-02-28T14:16:11.000Z
|
2019-05-07T18:02:16.000Z
|
from unittest import TestCase
from util.boyer_moore_search import z_array
from util.boyer_moore_search import boyer_moore, BoyerMoore
__author__ = 'Yifei'
| 32.508197
| 96
| 0.498739
|
270b35ddd89f3b512a06eb79c89fed5ad60c1aca
| 1,668
|
py
|
Python
|
authentication/views.py
|
ManasUniyal/RoadView
|
593a4f86cb10efdbf560fc4aec3d58a9b5b41bd2
|
[
"MIT"
] | null | null | null |
authentication/views.py
|
ManasUniyal/RoadView
|
593a4f86cb10efdbf560fc4aec3d58a9b5b41bd2
|
[
"MIT"
] | null | null | null |
authentication/views.py
|
ManasUniyal/RoadView
|
593a4f86cb10efdbf560fc4aec3d58a9b5b41bd2
|
[
"MIT"
] | null | null | null |
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.models import User
from django.shortcuts import render, redirect
# Create your views here.
| 35.489362
| 71
| 0.63789
|
270baa9c084cf98e0065fdca116072edd2dacd09
| 1,335
|
py
|
Python
|
dz3/task3_5.py
|
EsipenkoAnna/PycharmProjects-EsipenkoAnna_2242
|
46fe55de36b7b1cfdeafcf685ea01c6220e16546
|
[
"MIT"
] | null | null | null |
dz3/task3_5.py
|
EsipenkoAnna/PycharmProjects-EsipenkoAnna_2242
|
46fe55de36b7b1cfdeafcf685ea01c6220e16546
|
[
"MIT"
] | null | null | null |
dz3/task3_5.py
|
EsipenkoAnna/PycharmProjects-EsipenkoAnna_2242
|
46fe55de36b7b1cfdeafcf685ea01c6220e16546
|
[
"MIT"
] | null | null | null |
import random
nouns = ["", "", "", "", ""]
adverbs = ["", "", "", "", ""]
adjectives = ["", "", "", "", ""]
print(get_jokes(6))
print(get_jokes_adv(2,False))
print(nouns, adverbs, adjectives) #,
| 36.081081
| 145
| 0.698127
|
270e32ac710b649bd41e91bee859d8ce32b8ac58
| 1,140
|
py
|
Python
|
unit_03/06_Dates_and_Time/1-Dates_and_Time/4_timestrings.py
|
duliodenis/python_master_degree
|
3ab76838ce2fc1606f28e988a3273dd27122a621
|
[
"MIT"
] | 19
|
2019-03-14T01:39:32.000Z
|
2022-02-03T00:36:43.000Z
|
unit_03/06_Dates_and_Time/1-Dates_and_Time/4_timestrings.py
|
duliodenis/python_master_degree
|
3ab76838ce2fc1606f28e988a3273dd27122a621
|
[
"MIT"
] | 1
|
2020-04-10T01:01:16.000Z
|
2020-04-10T01:01:16.000Z
|
unit_03/06_Dates_and_Time/1-Dates_and_Time/4_timestrings.py
|
duliodenis/python_master_degree
|
3ab76838ce2fc1606f28e988a3273dd27122a621
|
[
"MIT"
] | 5
|
2019-01-02T20:46:05.000Z
|
2020-07-08T22:47:48.000Z
|
#
# Dates and Times in Python: Dates & Time
# Python Techdegree
#
# Created by Dulio Denis on 12/24/18.
# Copyright (c) 2018 ddApps. All rights reserved.
# ------------------------------------------------
# Challenge 4: strftime & strptime
# ------------------------------------------------
# Challenge Task 1 of 2
# Create a function named to_string that takes a
# datetime and gives back a string in the format
# "24 September 2012".
# ## Examples
# to_string(datetime_object) => "24 September 2012"
# from_string("09/24/12 18:30", "%m/%d/%y %H:%M") => datetime
import datetime
# TEST
dt = datetime.datetime.now()
print(to_string(dt))
# Challenge Task 2 of 2
# Create a new function named from_string that takes two arguments:
# a date as a string and an strftime-compatible format string, and
# returns a datetime created from them.
# TEST
date_string = "24 December 2018"
date_format = "%d %B %Y"
print(from_string(date_string, date_format))
| 30
| 69
| 0.650877
|
27103b13e18c6af23c06877c02e17d64b07756a6
| 177
|
py
|
Python
|
server/DresseurModele.py
|
crancerkill/pokeploud
|
d01c596591382fdec62958896e3ec6a6bb3d1ab9
|
[
"Apache-2.0"
] | null | null | null |
server/DresseurModele.py
|
crancerkill/pokeploud
|
d01c596591382fdec62958896e3ec6a6bb3d1ab9
|
[
"Apache-2.0"
] | null | null | null |
server/DresseurModele.py
|
crancerkill/pokeploud
|
d01c596591382fdec62958896e3ec6a6bb3d1ab9
|
[
"Apache-2.0"
] | null | null | null |
from google.appengine.ext import ndb
| 25.285714
| 43
| 0.723164
|
2712d71cebd1c1c0c5ebe71fa2604a188a12e044
| 331
|
py
|
Python
|
core/migrations/0003_remove_resetpassword_expires_at.py
|
GolamMullick/HR_PROJECT
|
fc4c76cfc835ad014a62a3da9d32b8fc8d474397
|
[
"MIT"
] | null | null | null |
core/migrations/0003_remove_resetpassword_expires_at.py
|
GolamMullick/HR_PROJECT
|
fc4c76cfc835ad014a62a3da9d32b8fc8d474397
|
[
"MIT"
] | 3
|
2020-02-12T02:52:01.000Z
|
2021-06-10T22:18:25.000Z
|
core/migrations/0003_remove_resetpassword_expires_at.py
|
GolamMullick/HR_PROJECT
|
fc4c76cfc835ad014a62a3da9d32b8fc8d474397
|
[
"MIT"
] | null | null | null |
# Generated by Django 2.1.4 on 2019-11-18 11:00
from django.db import migrations
| 18.388889
| 47
| 0.595166
|
2713ca1136e8fbc548b8d5161cb677f262b46b5a
| 22,410
|
py
|
Python
|
toolbox_plotting.py
|
roughhawkbit/robs-python-scripts
|
7d9a28cff106887553970b5c4c37cd53a836c2ff
|
[
"MIT"
] | null | null | null |
toolbox_plotting.py
|
roughhawkbit/robs-python-scripts
|
7d9a28cff106887553970b5c4c37cd53a836c2ff
|
[
"MIT"
] | 1
|
2015-02-23T16:31:21.000Z
|
2015-02-25T16:34:14.000Z
|
toolbox_plotting.py
|
roughhawkbit/robs-python-scripts
|
7d9a28cff106887553970b5c4c37cd53a836c2ff
|
[
"MIT"
] | null | null | null |
#!/usr/bin/python
from __future__ import division
from __future__ import with_statement
import matplotlib
from matplotlib import rcParams
from matplotlib import pyplot
from mpl_toolkits.axes_grid1 import make_axes_locatable
from mpl_toolkits.mplot3d import Axes3D
from PIL import Image
#import Image
from pylab import *
import matplotlib.cbook as cbook
import numpy
import os
import random
from scipy.spatial import KDTree
from scipy.stats import linregress
import toolbox_basic
# University of Birmingham (UK) thesis guidelines state:
# - inner margin = 30mm, outer margin = 20mm, so double column = 160mm
# - top margin = bottom margin = 30mm, so maximum height = 237mm
def padding_axis(axis, side="right", pad=0.04):
divider = make_axes_locatable(axis)
cax = divider.append_axes(side, size="5%", pad=pad, axisbg='none')
return cax
def empty_padding_axis(axis, side="right"):
cax = padding_axis(axis, side=side)
cax.set_xticklabels(['']*10)
cax.set_yticklabels(['']*10)
for spine in ['right', 'left', 'top', 'bottom']:
cax.spines[spine].set_color('none')
cax.tick_params(top="off", bottom="off", right="off", left="off")
return cax
def make_colorbar(axis, colorscheme, side="right", fontsize=10, pad=0.04):
cax = padding_axis(axis, side=side, pad=pad)
orientation = 'vertical' if side in ["right", "left"] else 'horizontal'
cbar = pyplot.colorbar(colorscheme, cax=cax, orientation=orientation)
cbar.ax.tick_params(labelsize=fontsize)
return cbar
def colorbar_on_right(axis, colorscheme, fontsize=10):
#divider = make_axes_locatable(axis)
#cax = divider.append_axes("right", size="5%", pad=0.04)
#cax = space_on_right(axis)
#cbar = pyplot.colorbar(colorscheme, cax=cax)
#cbar.ax.tick_params(labelsize=fontsize)
print '\n\ntoolbox_plotting.colorbar_on_right() is deprecated'
print 'Please use toolbox_plotting.make_colorbar() instead\n\n'
cbar = make_colorbar(axis, colorscheme, side="right")
return cbar
def draw_linear_regression(axis, color, x_vals, y_vals):
slope, intercept, r_value, p_value, std_err = linregress(x_vals, y_vals)
x1, x2 = min(x_vals), max(x_vals)
y1, y2 = x1*slope + intercept, x2*slope + intercept
axis.plot([x1, x2], [y1, y2], color)
return r_value, p_value, std_err
| 46.784969
| 88
| 0.585988
|
27148ed5395addc00af60f81418ead72ae8e82d5
| 568
|
py
|
Python
|
melon_modules/moderation.py
|
WeMayNeverKnow/MelonMintBots
|
6feac66a25ad86ab0c9a8b41f4cdae819f4e9fbd
|
[
"MIT"
] | null | null | null |
melon_modules/moderation.py
|
WeMayNeverKnow/MelonMintBots
|
6feac66a25ad86ab0c9a8b41f4cdae819f4e9fbd
|
[
"MIT"
] | null | null | null |
melon_modules/moderation.py
|
WeMayNeverKnow/MelonMintBots
|
6feac66a25ad86ab0c9a8b41f4cdae819f4e9fbd
|
[
"MIT"
] | null | null | null |
from hata import Client
MELON : Client
#@MELON.commands.from_class
#class prefix:
# pass
#@MELON.commands.from_class
#class slowmode:
# pass
#@MELON.commands.from_class
#class logs:
# pass
#@MELON.commands.from_class
#class warn:
# pass
#@MELON.commands.from_class
#class mute:
# pass
#@MELON.commands.from_class
#class kick:
# pass
#@MELON.commands.from_class
#class ban:
# pass
#@MELON.commands.from_class
#class lock:
# pass
#@MELON.commands.from_class
#class unlock:
# pass
#@MELON.commands.from_class
#class clear:
# pass
| 12.909091
| 27
| 0.702465
|
27155b9a924aec60a88449cb892d18dddf705986
| 5,837
|
py
|
Python
|
bundled/linter/linter_server.py
|
luabud/vscode-pylint
|
2297f1a6210bf93f7d9c083e32c59ed03664ca05
|
[
"MIT"
] | null | null | null |
bundled/linter/linter_server.py
|
luabud/vscode-pylint
|
2297f1a6210bf93f7d9c083e32c59ed03664ca05
|
[
"MIT"
] | null | null | null |
bundled/linter/linter_server.py
|
luabud/vscode-pylint
|
2297f1a6210bf93f7d9c083e32c59ed03664ca05
|
[
"MIT"
] | null | null | null |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Implementation of linting support over LSP.
"""
import json
import pathlib
import sys
from typing import Dict, Sequence, Union
# Ensure that will can import LSP libraries, and other bundled linter libraries
sys.path.append(str(pathlib.Path(__file__).parent.parent / "libs"))
# pylint: disable=wrong-import-position,import-error
import utils
from pygls import lsp, server
from pygls.lsp import types
all_configurations = {
"name": "Pylint",
"module": "pylint",
"patterns": {
"default": {
"regex": "",
"args": ["--reports=n", "--output-format=json"],
"lineStartsAt1": True,
"columnStartsAt1": False,
"useStdin": True,
}
},
}
SETTINGS = {}
LINTER = {}
MAX_WORKERS = 5
LSP_SERVER = server.LanguageServer(max_workers=MAX_WORKERS)
def _get_severity(
symbol: str, code: str, code_type: str, severity: Dict[str, str]
) -> types.DiagnosticSeverity:
"""Converts severity provided by linter to LSP specific value."""
value = (
severity.get(symbol, None)
or severity.get(code, None)
or severity.get(code_type, "Error")
)
try:
return types.DiagnosticSeverity[value]
except KeyError:
pass
return types.DiagnosticSeverity.Error
def _parse_output(
content: str,
line_at_1: bool,
column_at_1: bool,
severity: Dict[str, str],
additional_offset: int = 0,
) -> Sequence[types.Diagnostic]:
"""Parses linter messages and return LSP diagnostic object for each message."""
diagnostics = []
line_offset = (1 if line_at_1 else 0) + additional_offset
col_offset = 1 if column_at_1 else 0
messages = json.loads(content)
for data in messages:
start = types.Position(
line=int(data["line"]) - line_offset,
character=int(data["column"]) - col_offset,
)
if data["endLine"] is not None:
end = types.Position(
line=int(data["endLine"]) - line_offset,
character=int(data["endColumn"]) - col_offset,
)
else:
end = start
diagnostic = types.Diagnostic(
range=types.Range(
start=start,
end=end,
),
message=data["message"],
severity=_get_severity(
data["symbol"], data["message-id"], data["type"], severity
),
code=f"{data['message-id']}:{ data['symbol']}",
source=LINTER["name"],
)
diagnostics.append(diagnostic)
return diagnostics
def _lint_and_publish_diagnostics(
params: Union[types.DidOpenTextDocumentParams, types.DidSaveTextDocumentParams]
) -> None:
"""Runs linter, processes the output, and publishes the diagnostics over LSP."""
document = LSP_SERVER.workspace.get_document(params.text_document.uri)
if utils.is_stdlib_file(document.path):
# Don't lint standard library python files.
# Publishing empty diagnostics clears the entry.
LSP_SERVER.publish_diagnostics(document.uri, [])
return
module = LINTER["module"]
use_stdin = LINTER["useStdin"]
use_path = len(SETTINGS["path"]) > 0
argv = SETTINGS["path"] if use_path else [module]
argv += LINTER["args"] + SETTINGS["args"]
argv += ["--from-stdin", document.path] if use_stdin else [document.path]
if use_path:
result = utils.run_path(argv, use_stdin, document.source)
else:
# This is needed to preserve sys.path, pylint modifies
# sys.path and that might not work for this scenario
# next time around.
with utils.SubstituteAttr(sys, "path", sys.path[:]):
result = utils.run_module(module, argv, use_stdin, document.source)
if result.stderr:
LSP_SERVER.show_message_log(result.stderr)
LSP_SERVER.show_message_log(f"{document.uri} :\r\n{result.stdout}")
diagnostics = _parse_output(
result.stdout,
LINTER["lineStartsAt1"],
LINTER["columnStartsAt1"],
SETTINGS["severity"],
)
LSP_SERVER.publish_diagnostics(document.uri, diagnostics)
if __name__ == "__main__":
LSP_SERVER.start_io()
| 31.38172
| 88
| 0.664211
|
2717b6d6d414bb9ece4ff0a008bac03ea5586ef2
| 27
|
py
|
Python
|
api/web/__init__.py
|
AutoCoinDCF/NEW_API
|
f4abc48fff907a0785372b941afcd67e62eec825
|
[
"Apache-2.0"
] | null | null | null |
api/web/__init__.py
|
AutoCoinDCF/NEW_API
|
f4abc48fff907a0785372b941afcd67e62eec825
|
[
"Apache-2.0"
] | null | null | null |
api/web/__init__.py
|
AutoCoinDCF/NEW_API
|
f4abc48fff907a0785372b941afcd67e62eec825
|
[
"Apache-2.0"
] | null | null | null |
from .webapi import WebAPI
| 13.5
| 26
| 0.814815
|
27183201b985ec1686bc23947d232084caa6809f
| 422
|
py
|
Python
|
example/test.py
|
long-gong/libbloom-wrapper
|
628f8ce11a6708d53bb56104182909ca40951f4f
|
[
"BSD-2-Clause"
] | null | null | null |
example/test.py
|
long-gong/libbloom-wrapper
|
628f8ce11a6708d53bb56104182909ca40951f4f
|
[
"BSD-2-Clause"
] | null | null | null |
example/test.py
|
long-gong/libbloom-wrapper
|
628f8ce11a6708d53bb56104182909ca40951f4f
|
[
"BSD-2-Clause"
] | null | null | null |
from pybloom import BloomFilter
if __name__ == '__main__':
total_items = 9585058
error = 0.01
bf = BloomFilter(capacity=total_items, error_rate=error)
for i in range(total_items):
bf.add(i)
cf = 0
ct = 0
for i in range(total_items, 2*total_items):
if i in bf:
cf += 1
ct += 1
fpr = cf * 1.0 / ct * 100
print("false positive rate: %.2f" % fpr)
| 22.210526
| 60
| 0.566351
|
2718f33aa7d3ea7dfd6692935997031e9e47c7ff
| 397
|
py
|
Python
|
ifcbdb/dashboard/migrations/0033_dataset_doi.py
|
veot/ifcbdb
|
427be36d92ca3c2dc6c8c10aaba94fcadc7cc93e
|
[
"MIT"
] | 4
|
2019-05-23T13:38:36.000Z
|
2021-02-25T23:08:24.000Z
|
ifcbdb/dashboard/migrations/0033_dataset_doi.py
|
veot/ifcbdb
|
427be36d92ca3c2dc6c8c10aaba94fcadc7cc93e
|
[
"MIT"
] | 313
|
2019-05-14T19:43:17.000Z
|
2022-03-21T14:40:15.000Z
|
ifcbdb/dashboard/migrations/0033_dataset_doi.py
|
veot/ifcbdb
|
427be36d92ca3c2dc6c8c10aaba94fcadc7cc93e
|
[
"MIT"
] | 3
|
2020-10-26T05:23:04.000Z
|
2021-07-22T09:54:56.000Z
|
# Generated by Django 2.1.7 on 2019-10-31 16:30
from django.db import migrations, models
| 20.894737
| 63
| 0.602015
|
271c49cbaa02490060b18e56f8f7193420d20ee7
| 2,411
|
py
|
Python
|
src/utils/roles.py
|
dciborow/SubscriptionPolicy
|
100718bca552fb92edcb1867a94aba1f2d131edc
|
[
"MIT"
] | null | null | null |
src/utils/roles.py
|
dciborow/SubscriptionPolicy
|
100718bca552fb92edcb1867a94aba1f2d131edc
|
[
"MIT"
] | null | null | null |
src/utils/roles.py
|
dciborow/SubscriptionPolicy
|
100718bca552fb92edcb1867a94aba1f2d131edc
|
[
"MIT"
] | null | null | null |
from .cmdline import CmdUtils
| 26.788889
| 106
| 0.520116
|
271ca124718f33d6bf24a7362d654f72b7d37716
| 950
|
py
|
Python
|
babyonboard/api/migrations/0005_auto_20171124_1824.py
|
BabyOnBoard/BabyOnBoard-API
|
eef34bf4e9649409a3158d6826432acb040afa32
|
[
"MIT"
] | null | null | null |
babyonboard/api/migrations/0005_auto_20171124_1824.py
|
BabyOnBoard/BabyOnBoard-API
|
eef34bf4e9649409a3158d6826432acb040afa32
|
[
"MIT"
] | 10
|
2017-11-23T18:28:11.000Z
|
2021-06-10T19:53:06.000Z
|
babyonboard/api/migrations/0005_auto_20171124_1824.py
|
BabyOnBoard/BabyOnBoard-API
|
eef34bf4e9649409a3158d6826432acb040afa32
|
[
"MIT"
] | null | null | null |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-11-24 18:24
from __future__ import unicode_literals
from django.db import migrations, models
| 31.666667
| 169
| 0.566316
|
271d8ca306320152e2b945243d46ba85a77910e7
| 1,880
|
py
|
Python
|
harmoni_actuators/harmoni_speaker/test/unittest_speaker.py
|
interaction-lab/HARMONI
|
9c88019601a983a1739744919a95247a997d3bb1
|
[
"MIT"
] | 7
|
2020-09-02T06:31:21.000Z
|
2022-02-18T21:16:44.000Z
|
harmoni_actuators/harmoni_speaker/test/unittest_speaker.py
|
micolspitale93/HARMONI
|
cf6a13fb85e3efb4e421dbfd4555359c0a04acaa
|
[
"MIT"
] | 61
|
2020-05-15T16:46:32.000Z
|
2021-07-28T17:44:49.000Z
|
harmoni_actuators/harmoni_speaker/test/unittest_speaker.py
|
micolspitale93/HARMONI
|
cf6a13fb85e3efb4e421dbfd4555359c0a04acaa
|
[
"MIT"
] | 3
|
2020-10-05T23:01:29.000Z
|
2022-03-02T11:53:34.000Z
|
#!/usr/bin/env python3
PKG = 'test_harmoni_speaker'
# Common Imports
import unittest, rospy, rospkg, roslib, sys
#from unittest.mock import Mock, patch
# Specific Imports
from actionlib_msgs.msg import GoalStatus
from harmoni_common_msgs.msg import harmoniAction, harmoniFeedback, harmoniResult
from harmoni_common_lib.constants import State
from std_msgs.msg import String
import os, io
import ast
from harmoni_speaker.speaker_service import SpeakerService
import json
if __name__ == "__main__":
main()
| 35.471698
| 95
| 0.710106
|
271fa52916c14e0243668b5ba4593d20238992fd
| 3,996
|
py
|
Python
|
ExCon/explainer.py
|
DarrenZhang01/ExCon
|
2467c2fa8c0c52edaf54091d2bfecd132eeae594
|
[
"Apache-2.0"
] | 17
|
2021-11-30T03:50:24.000Z
|
2022-01-16T10:58:07.000Z
|
ExCon/explainer.py
|
DarrenZhang01/ExCon
|
2467c2fa8c0c52edaf54091d2bfecd132eeae594
|
[
"Apache-2.0"
] | 1
|
2021-12-04T02:35:59.000Z
|
2021-12-05T00:53:35.000Z
|
ExCon/explainer.py
|
DarrenZhang01/ExCon
|
2467c2fa8c0c52edaf54091d2bfecd132eeae594
|
[
"Apache-2.0"
] | null | null | null |
"""
An utility class for initializing different explainer objects.
"""
from torch import nn
import numpy as np
from captum.attr import DeepLift, IntegratedGradients, ShapleyValueSampling, LayerGradCam, Saliency
from captum.attr._utils.attribution import LayerAttribution
| 47.571429
| 108
| 0.567067
|
271fe8cb4638bb263355e0c702a01f25cb73e941
| 2,188
|
py
|
Python
|
django/www/MeteoGaliciaDB/registros/views.py
|
hugo-lorenzo-mato/Meteo-Galicia-DB
|
3dd52534c16216de5f25cd40877d2facc7cffe24
|
[
"MIT"
] | null | null | null |
django/www/MeteoGaliciaDB/registros/views.py
|
hugo-lorenzo-mato/Meteo-Galicia-DB
|
3dd52534c16216de5f25cd40877d2facc7cffe24
|
[
"MIT"
] | null | null | null |
django/www/MeteoGaliciaDB/registros/views.py
|
hugo-lorenzo-mato/Meteo-Galicia-DB
|
3dd52534c16216de5f25cd40877d2facc7cffe24
|
[
"MIT"
] | 1
|
2021-04-27T18:37:41.000Z
|
2021-04-27T18:37:41.000Z
|
from django.shortcuts import render
from . import forms
from django.core.urlresolvers import reverse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate,login,logout
# Create your views here.
def registro(request):
registered = False
if request.method == 'POST':
user_form = forms.UserForm(data=request.POST)
profile_form = forms.UserProfileInfo(data=request.POST)
if user_form.is_valid() and profile_form.is_valid():
user = user_form.save()
user.set_password(user.password)
user.save()
profile = profile_form.save(commit=False)
profile.user = user
if 'profile_pic' in request.FILES:
profile.profile_pic = request.FILES['profile_pic']
profile.save()
registered = True
else:
print(user_form.errors,profile_form.errors)
else:
user_form = forms.UserForm()
profile_form = forms.UserProfileInfo()
return render(request,'registros/registration.html', {'registered': registered, 'user_form': user_form,'profile_form':profile_form})
def user_login(request):
logged = False
if request.method == 'POST':
username = request.POST.get('username')
password = request.POST.get('password')
user = authenticate(username=username, password=password)
if user:
if user.is_active:
login(request, user)
logged = True
return render(request, 'registros/login.html', {'logged': logged})
else:
return HttpResponse("Cuenta inactiva")
else:
print("Alguien intento loguearse y fall")
return HttpResponse("Datos de acceso invlidos")
else:
return render(request, 'registros/login.html',{'logged':logged})
| 33.151515
| 136
| 0.652194
|
2721ab7a1f61ce9281bd09517b3b6a6328c17752
| 708
|
py
|
Python
|
geotrek/outdoor/admin.py
|
numahell/Geotrek-admin
|
e279875b0b06ef60928c049d51533f76716c902a
|
[
"BSD-2-Clause"
] | 1
|
2019-12-11T11:04:05.000Z
|
2019-12-11T11:04:05.000Z
|
geotrek/outdoor/admin.py
|
numahell/Geotrek-admin
|
e279875b0b06ef60928c049d51533f76716c902a
|
[
"BSD-2-Clause"
] | null | null | null |
geotrek/outdoor/admin.py
|
numahell/Geotrek-admin
|
e279875b0b06ef60928c049d51533f76716c902a
|
[
"BSD-2-Clause"
] | null | null | null |
from django.conf import settings
from django.contrib import admin
from geotrek.common.admin import MergeActionMixin
from geotrek.outdoor.models import Practice, SiteType
if 'modeltranslation' in settings.INSTALLED_APPS:
from modeltranslation.admin import TranslationAdmin
else:
TranslationAdmin = admin.ModelAdmin
| 28.32
| 56
| 0.75565
|
2723629eca545ab7058f06d730db5b5baa33b30a
| 3,516
|
py
|
Python
|
gdrive.py
|
abwilf/Factorized
|
64e7d2a54bbfbc8b1c5a2130f2b941c376402fe6
|
[
"MIT"
] | null | null | null |
gdrive.py
|
abwilf/Factorized
|
64e7d2a54bbfbc8b1c5a2130f2b941c376402fe6
|
[
"MIT"
] | null | null | null |
gdrive.py
|
abwilf/Factorized
|
64e7d2a54bbfbc8b1c5a2130f2b941c376402fe6
|
[
"MIT"
] | null | null | null |
from __future__ import print_function
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from apiclient.http import MediaFileUpload
import gdown
def gdrive_up(credentials_path, file_list, folder_id, token_path='/work/awilf/utils/gdrive_token.json'):
'''
credentials_path: json containing gdrive credentials of form {"installed":{"client_id":"<something>.apps.googleusercontent.com","project_id":"decisive-engine-<something>","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"<client_secret>","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
file_list: full path of files to upload, e.g. ['/work/awilf/tonicnet.tar']
folder_id: id of folder you've already created in google drive (awilf@andrew account, for these credentials)
e.g.
gdrive_up('gdrive_credentials.json', ['hi.txt', 'yo.txt'], '1E1ub35TDJP59rlIqDBI9SLEncCEaI4aT')
note: if token_path does not exist, you will need to authenticate. here are the instructions
ON MAC: ssh -N -f -L localhost:8080:localhost:8080 awilf@taro
ON MAC (CHROME): go to link provided
'''
# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/drive.metadata.readonly', 'https://www.googleapis.com/auth/drive.file']
creds = None
if os.path.exists(token_path): # UNCOMMENT THIS IF DON'T WANT TO LOG IN EACH TIME
creds = Credentials.from_authorized_user_file(token_path, SCOPES)
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(credentials_path, SCOPES)
creds = flow.run_local_server(port=8080)
with open(token_path, 'w') as token:
token.write(creds.to_json())
service = build('drive', 'v3', credentials=creds)
for name in file_list:
file_metadata = {
'name': name,
'parents': [folder_id]
}
media = MediaFileUpload(file_metadata['name'], resumable=True)
file = service.files().create(body=file_metadata, media_body=media, fields='id').execute()
def gdrive_down(url, out_path=None):
'''
first, make sure file in url is available for anyone to view
url should be of one of these forms:
https://drive.google.com/file/d/195C6CoqMBYzteJIx-FFOsNFATvu5cr_z/view?usp=sharing
https://drive.google.com/uc?id=1eGj8DSau66NiklH30UIGab55cUWR_qw9
out_path can be None, in which case the result will be the file name from google drive saved in ./. else, save to out_path
'''
if 'uc?' not in url:
id = url.split('/')[-2]
url = f'https://drive.google.com/uc?id={id}'
gdown.download(url, out_path)
# gdrive_down('https://drive.google.com/file/d/1dAvxdsHWbtA1ZIh3Ex9DPn9Nemx9M1-L/view', out_path='/work/awilf/mfa/')
# gdrive_down('https://drive.google.com/file/d/1XEsc6rLXtjfo2rtms2GR0hDqfTiat5Zo/view?usp=sharing')
# gdrive_up('/work/awilf/utils/gdrive_credentials.json', ['pyg.sif'], '1zBldu3ipR6LtrJBxxNlaKBPW_kio6nli')
gdrive_down('https://drive.google.com/file/d/1eEdRQVgBCcq8DyasduZpMzTlCIjrekLM/view?usp=sharing')
| 45.662338
| 455
| 0.71587
|
2725c4c1b926b1b3e672d43af2ed2535f3dcf9a6
| 705
|
py
|
Python
|
web_ext/sseq_gui/tests/test_load.py
|
hoodmane/sseq
|
0f19a29c95486a629b0d054c703ca0a58999ae97
|
[
"Apache-2.0",
"MIT"
] | 7
|
2021-04-22T04:06:09.000Z
|
2022-01-25T04:05:49.000Z
|
web_ext/sseq_gui/tests/test_load.py
|
hoodmane/sseq
|
0f19a29c95486a629b0d054c703ca0a58999ae97
|
[
"Apache-2.0",
"MIT"
] | 68
|
2020-03-21T22:37:24.000Z
|
2022-03-31T02:51:35.000Z
|
web_ext/sseq_gui/tests/test_load.py
|
hoodmane/sseq
|
0f19a29c95486a629b0d054c703ca0a58999ae97
|
[
"Apache-2.0",
"MIT"
] | 5
|
2021-02-17T06:37:43.000Z
|
2022-02-01T03:53:22.000Z
|
import pytest
from pathlib import Path
| 30.652174
| 85
| 0.673759
|
2726aff9726f405364127c08f5f1c2bf93aa5997
| 91
|
py
|
Python
|
src/rocket/stage2/src/errors/src/SensorOverload.py
|
proballstar/atlas
|
6e4eb36b7e43e750dbb281c2051439198c82f296
|
[
"MIT"
] | null | null | null |
src/rocket/stage2/src/errors/src/SensorOverload.py
|
proballstar/atlas
|
6e4eb36b7e43e750dbb281c2051439198c82f296
|
[
"MIT"
] | null | null | null |
src/rocket/stage2/src/errors/src/SensorOverload.py
|
proballstar/atlas
|
6e4eb36b7e43e750dbb281c2051439198c82f296
|
[
"MIT"
] | null | null | null |
# @TODO(aaronhma): UPDATE
# @TODO(aaronhma): UPDATE
| 18.2
| 29
| 0.626374
|
2727cc439b34121ae42c9bebd5ffc173f65fc3c6
| 5,905
|
py
|
Python
|
foresight/environment/environment_info_support.py
|
thundra-io/thundra-agent-python
|
448e18c17d8730c381b2e2a773782cf80c5a7cfb
|
[
"Apache-2.0"
] | 15
|
2021-07-28T08:03:50.000Z
|
2021-11-08T08:36:06.000Z
|
foresight/environment/environment_info_support.py
|
thundra-io/thundra-agent-python
|
448e18c17d8730c381b2e2a773782cf80c5a7cfb
|
[
"Apache-2.0"
] | 1
|
2021-08-08T07:45:45.000Z
|
2021-08-08T12:41:36.000Z
|
foresight/environment/environment_info_support.py
|
thundra-io/thundra-agent-python
|
448e18c17d8730c381b2e2a773782cf80c5a7cfb
|
[
"Apache-2.0"
] | 3
|
2021-08-07T14:19:23.000Z
|
2021-12-08T15:35:40.000Z
|
import os, logging
from foresight.environment.git.git_helper import GitHelper
from foresight.environment.git.git_env_info_provider import GitEnvironmentInfoProvider
from foresight.environment.github.github_environment_info_provider import GithubEnvironmentInfoProvider
from foresight.environment.gitlab.gitlab_environment_info_provider import GitlabEnvironmentInfoProvider
from foresight.environment.jenkins.jenkins_environment_info_provider import JenkinsEnvironmentInfoProvider
from foresight.environment.travisci.travisci_environment_info_provider import TravisCIEnvironmentInfoProvider
from foresight.environment.circleci.circleci_environment_info_provider import CircleCIEnvironmentInfoProvider
from foresight.environment.bitbucket.bitbucket_environment_info_provider import BitbucketEnvironmentInfoProvider
from foresight.environment.azure.azure_environment_info_provider import AzureEnvironmentInfoProvider
from foresight.test_runner_tags import TestRunnerTags
from foresight.utils.generic_utils import print_debug_message_to_console
LOGGER = logging.getLogger(__name__)
| 60.255102
| 150
| 0.720745
|
272ad5e735d859c51d641dfdb613ff9296e5cbee
| 660
|
py
|
Python
|
Problem_Solving/Algorithms/Warmup/6_Plus_Minus/Solution.py
|
CFLSousa/HackerRank
|
29ed039634e88d72981b2ecd619e5c65d37111e4
|
[
"MIT"
] | null | null | null |
Problem_Solving/Algorithms/Warmup/6_Plus_Minus/Solution.py
|
CFLSousa/HackerRank
|
29ed039634e88d72981b2ecd619e5c65d37111e4
|
[
"MIT"
] | null | null | null |
Problem_Solving/Algorithms/Warmup/6_Plus_Minus/Solution.py
|
CFLSousa/HackerRank
|
29ed039634e88d72981b2ecd619e5c65d37111e4
|
[
"MIT"
] | null | null | null |
import math
import os
import random
import re
import sys
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().rstrip().split()))
plusMinus(arr)
| 18.333333
| 71
| 0.59697
|
272af550504e85a1489b88397788f6d4d8f037c0
| 1,403
|
py
|
Python
|
golang/godoc.py
|
nlfiedler/devscripts
|
122c7b1424b457d7d5499552065da83d76f6b922
|
[
"BSD-3-Clause"
] | null | null | null |
golang/godoc.py
|
nlfiedler/devscripts
|
122c7b1424b457d7d5499552065da83d76f6b922
|
[
"BSD-3-Clause"
] | 1
|
2015-03-04T15:01:08.000Z
|
2015-03-04T15:01:08.000Z
|
golang/godoc.py
|
nlfiedler/devscripts
|
122c7b1424b457d7d5499552065da83d76f6b922
|
[
"BSD-3-Clause"
] | null | null | null |
#!/usr/bin/env python3
"""Start the godoc server and open the docs in a browser window.
This uses the 'open' command to open a web browser.
"""
import argparse
import http
import http.client
import subprocess
import time
def is_ready(host, port):
"""Check if the web server returns an OK status."""
conn = http.client.HTTPConnection(host, port)
try:
conn.request('HEAD', '/')
resp = conn.getresponse()
return resp.status == 200
except ConnectionRefusedError:
return False
def main():
"""Do the thing."""
parser = argparse.ArgumentParser(description='Spawn godoc and open browser window.')
parser.add_argument('--port', help='port on which to run godoc', default=6060)
args = parser.parse_args()
host = "localhost"
port = args.port
# If not already running, start godoc in the background and wait for it
# to be ready by making an HTTP request and checking the status.
if not is_ready(host, port):
subprocess.Popen(["godoc", "-http=:{port}".format(port=port)])
while True:
if is_ready(host, port):
break
print('Waiting for server to start...')
time.sleep(1)
# Open the docs in a browser window.
url = "http://{host}:{port}".format(host=host, port=port)
subprocess.check_call(["open", url])
if __name__ == "__main__":
main()
| 26.980769
| 88
| 0.639344
|
272b0f6329b631e0b33f8623045bec69644ef0db
| 19,371
|
py
|
Python
|
mgsa/evaluate_repeats.py
|
supernifty/mgsa
|
5f950f8c9c2bf0439a100a2348f1aef478e32934
|
[
"MIT"
] | 2
|
2016-11-02T20:27:00.000Z
|
2019-10-23T08:14:44.000Z
|
mgsa/evaluate_repeats.py
|
supernifty/mgsa
|
5f950f8c9c2bf0439a100a2348f1aef478e32934
|
[
"MIT"
] | null | null | null |
mgsa/evaluate_repeats.py
|
supernifty/mgsa
|
5f950f8c9c2bf0439a100a2348f1aef478e32934
|
[
"MIT"
] | null | null | null |
import glob
import os
import random
import re
import sys
import numpy as np
import bio
import config
#
# experiment to see what position does with one mutation
# what is the effect of position?
#
#
# experiment to see what position does with one mutation
# what is the effect of position?
#
#
# what is the mapping quality as the distance between repeats and the read change?
#
#
# what is the mapping quality with ultra low entropy
#
#
# what is the mapping quality with tandem repeats
#
# make fasta
with open(sys.argv[2], 'w') as result_fh:
if sys.argv[3] == 'position':
experiment_pos( result_fh )
elif sys.argv[3] == 'genome':
experiment_genome_pos( result_fh )
elif sys.argv[3] == 'distance':
experiment_candidate_distance( result_fh )
elif sys.argv[3] == 'entropy':
experiment_entropy( result_fh )
elif sys.argv[3] == 'tandem':
experiment_tandem_repeats( result_fh )
elif sys.argv[3] == 'unmapped':
count_unmapped( sys.stdin, result_fh )
elif sys.argv[3] == 'clip':
count_clipped( sys.stdin, result_fh )
| 45.153846
| 285
| 0.58918
|
272e2592cfb00d569450c8c8739564bdd4f5c46a
| 393
|
py
|
Python
|
alembic/versions/e3dda7be6a95_extend_user_table.py
|
paul-wolf/bolo
|
936e73d80217a0fdbbd983cb1f775686809e1d25
|
[
"BSD-3-Clause"
] | null | null | null |
alembic/versions/e3dda7be6a95_extend_user_table.py
|
paul-wolf/bolo
|
936e73d80217a0fdbbd983cb1f775686809e1d25
|
[
"BSD-3-Clause"
] | null | null | null |
alembic/versions/e3dda7be6a95_extend_user_table.py
|
paul-wolf/bolo
|
936e73d80217a0fdbbd983cb1f775686809e1d25
|
[
"BSD-3-Clause"
] | null | null | null |
"""Extend user table
Revision ID: e3dda7be6a95
Revises:
Create Date: 2021-06-07 11:43:45.144088
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "e3dda7be6a95"
down_revision = None
branch_labels = None
depends_on = None
| 15.72
| 68
| 0.727735
|