hexsha stringlengths 40 40 | size int64 6 1.04M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 247 | 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 368k ⌀ | 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 4 247 | 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 4 247 | 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.04M | avg_line_length float64 1.53 618k | max_line_length int64 1 1.02M | alphanum_fraction float64 0 1 | original_content stringlengths 6 1.04M | filtered:remove_non_ascii int64 0 538k | filtered:remove_decorators int64 0 917k | filtered:remove_async int64 0 722k | filtered:remove_classes int64 -45 1M | filtered:remove_generators int64 0 814k | filtered:remove_function_no_docstring int64 -102 850k | filtered:remove_class_no_docstring int64 -3 5.46k | filtered:remove_unused_imports int64 -1,350 52.4k | filtered:remove_delete_markers int64 0 59.6k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cee50dbaf550492b0b7a5acbd949e37a38288f3b | 801 | py | Python | src/zzsn2021/utils/rundir.py | 2021L-ZZSN/template | 0cea7744701bb702d563acbf0cbd9ecf371f45bf | [
"MIT"
] | null | null | null | src/zzsn2021/utils/rundir.py | 2021L-ZZSN/template | 0cea7744701bb702d563acbf0cbd9ecf371f45bf | [
"MIT"
] | null | null | null | src/zzsn2021/utils/rundir.py | 2021L-ZZSN/template | 0cea7744701bb702d563acbf0cbd9ecf371f45bf | [
"MIT"
] | 1 | 2021-05-09T21:27:39.000Z | 2021-05-09T21:27:39.000Z | from __future__ import annotations
import os
from datetime import datetime
import coolname # type: ignore
from dotenv import load_dotenv
load_dotenv()
def setup_rundir():
"""
Create a working directory with a randomly generated run name.
"""
date = datetime.now().strftime("%Y%m%d-%H%M")
name =... | 27.62069 | 77 | 0.656679 | from __future__ import annotations
import os
from datetime import datetime
import coolname # type: ignore
from dotenv import load_dotenv
load_dotenv()
def setup_rundir():
"""
Create a working directory with a randomly generated run name.
"""
date = datetime.now().strftime("%Y%m%d-%H%M")
name =... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
5ee4f693c91d826992e4ab0a99fcaee72fdb7edb | 2,705 | py | Python | src/configflow/misc/string.py | volodymyrPivoshenko/configflow | 2158c8395c4913b836c2a27e38c51f5ec519323b | [
"MIT"
] | 8 | 2022-01-25T09:06:34.000Z | 2022-03-28T14:55:45.000Z | src/configflow/misc/string.py | volodymyrPivoshenko/configflow | 2158c8395c4913b836c2a27e38c51f5ec519323b | [
"MIT"
] | 23 | 2022-01-23T15:15:00.000Z | 2022-03-28T21:47:15.000Z | src/configflow/misc/string.py | volodymyrPivoshenko/configflow | 2158c8395c4913b836c2a27e38c51f5ec519323b | [
"MIT"
] | 1 | 2022-03-15T21:08:19.000Z | 2022-03-15T21:08:19.000Z | """Module for the string helper functions and primitive data types."""
from __future__ import annotations
import ast
import typing
import apm
# WPS600 - inheritance from the str is the only way to implement correct
# error message with all str functionality
def parse(value: str) -> typing.Optional[typing.Any]:
... | 29.086022 | 99 | 0.602957 | """Module for the string helper functions and primitive data types."""
from __future__ import annotations
import ast
import typing
import apm
# WPS600 - inheritance from the str is the only way to implement correct
# error message with all str functionality
class ErrorMessage(str): # noqa: WPS600
"""Implement... | 0 | 0 | 0 | 948 | 0 | 0 | 0 | 0 | 22 |
5024b443babb9d5f7f10c485d8a141f2f3c148b8 | 2,403 | py | Python | recipes/Python/510399_Byte_Hex_Hex_Byte_String/recipe-510399.py | tdiprima/code | 61a74f5f93da087d27c70b2efe779ac6bd2a3b4f | [
"MIT"
] | 2,023 | 2017-07-29T09:34:46.000Z | 2022-03-24T08:00:45.000Z | recipes/Python/510399_Byte_Hex_Hex_Byte_String/recipe-510399.py | unhacker/code | 73b09edc1b9850c557a79296655f140ce5e853db | [
"MIT"
] | 32 | 2017-09-02T17:20:08.000Z | 2022-02-11T17:49:37.000Z | recipes/Python/510399_Byte_Hex_Hex_Byte_String/recipe-510399.py | unhacker/code | 73b09edc1b9850c557a79296655f140ce5e853db | [
"MIT"
] | 780 | 2017-07-28T19:23:28.000Z | 2022-03-25T20:39:41.000Z | """
HexByteConversion
Convert a byte string to it's hex representation for output or visa versa.
ByteToHex converts byte string "\xFF\xFE\x00\x01" to the string "FF FE 00 01"
HexToByte converts string "FF FE 00 01" to the byte string "\xFF\xFE\x00\x01"
"""
#-----------------------------------------------------------... | 35.338235 | 90 | 0.554307 | """
HexByteConversion
Convert a byte string to it's hex representation for output or visa versa.
ByteToHex converts byte string "\xFF\xFE\x00\x01" to the string "FF FE 00 01"
HexToByte converts string "FF FE 00 01" to the byte string "\xFF\xFE\x00\x01"
"""
#-----------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
6810b1a32afedd13cfa216ce1724b423ebb45fe3 | 24,325 | py | Python | train_metarcnn.py | Anqw/meta_edge | 3c4b138f85d0c2c13c6cc1ee71e621737b40525c | [
"AFL-1.1"
] | null | null | null | train_metarcnn.py | Anqw/meta_edge | 3c4b138f85d0c2c13c6cc1ee71e621737b40525c | [
"AFL-1.1"
] | null | null | null | train_metarcnn.py | Anqw/meta_edge | 3c4b138f85d0c2c13c6cc1ee71e621737b40525c | [
"AFL-1.1"
] | null | null | null | # --------------------------------------------------------
# Pytorch Meta R-CNN
# Written by Anny Xu, Xiaopeng Yan, based on the code from Jianwei Yang
# --------------------------------------------------------
import os
import sys
import numpy as np
import argparse
import pprint
import time
import collections
import t... | 45.896226 | 147 | 0.575005 | # --------------------------------------------------------
# Pytorch Meta R-CNN
# Written by Anny Xu, Xiaopeng Yan, based on the code from Jianwei Yang
# --------------------------------------------------------
import _init_paths
import os
import sys
import numpy as np
import argparse
import pprint
import pdb
import ti... | 48 | 0 | 0 | 918 | 0 | 0 | 0 | 89 | 133 |
8b572207b8865cd9cdb8ae107f4ea6e1955c9b1c | 16,228 | py | Python | systems/GameGUI.py | itsabugnotafeature/Raiders | 72c20a83c253538a3a41658a78cbc0fe5eca346b | [
"MIT"
] | 1 | 2022-03-27T05:36:44.000Z | 2022-03-27T05:36:44.000Z | systems/GameGUI.py | itsabugnotafeature/Raiders | 72c20a83c253538a3a41658a78cbc0fe5eca346b | [
"MIT"
] | null | null | null | systems/GameGUI.py | itsabugnotafeature/Raiders | 72c20a83c253538a3a41658a78cbc0fe5eca346b | [
"MIT"
] | null | null | null | import scripts.gui_elements
| 47.311953 | 126 | 0.575857 | import scripts.gui_elements
import scripts.tools
from scripts.Colors import Color
from scripts.variables.localvars import *
from systems.BaseSystem import BaseSystem
from scripts import highlights
class GUI(BaseSystem):
def __init__(self):
self.Engine = None
self.game_vars = {}
self.GUIT... | 0 | 0 | 0 | 16,007 | 0 | 0 | 0 | 59 | 133 |
c5dc6a406b72c855d204ebef2026915104ccb941 | 10,616 | py | Python | system/events/mumble.py | UltrosBot/Ultros | 639efc11f73ebf7e8f47f0554aced00a559d9e2d | [
"Artistic-2.0"
] | 16 | 2015-01-02T00:16:11.000Z | 2019-06-03T06:23:11.000Z | system/events/mumble.py | UltrosBot/Ultros | 639efc11f73ebf7e8f47f0554aced00a559d9e2d | [
"Artistic-2.0"
] | 31 | 2015-01-18T12:14:53.000Z | 2018-01-07T13:32:29.000Z | system/events/mumble.py | UltrosBot/Ultros | 639efc11f73ebf7e8f47f0554aced00a559d9e2d | [
"Artistic-2.0"
] | 9 | 2015-02-13T09:38:53.000Z | 2020-11-29T19:59:32.000Z | # coding=utf-8
"""
Events specific to Mumble-based protocols
"""
__author__ = 'Gareth Coles'
| 20.815686 | 77 | 0.608986 | # coding=utf-8
"""
Events specific to Mumble-based protocols
"""
__author__ = 'Gareth Coles'
from system.events.base import BaseEvent
class MumbleEvent(BaseEvent):
"""
A Mumble event. This will only be thrown from the Mumble protocol.
If an event subclasses this, chances are it's a Mumble event.
""... | 0 | 0 | 0 | 9,831 | 0 | 0 | 0 | 19 | 644 |
9adb43ddfd7c249bcc04844d8cc841ab379b1785 | 7,009 | py | Python | wagtail_template/settings/base.py | b-ggs/wagtail-template | d6b7dfe4ab2cf0af8f412148b394d7b44a6a278a | [
"BSD-3-Clause"
] | null | null | null | wagtail_template/settings/base.py | b-ggs/wagtail-template | d6b7dfe4ab2cf0af8f412148b394d7b44a6a278a | [
"BSD-3-Clause"
] | null | null | null | wagtail_template/settings/base.py | b-ggs/wagtail-template | d6b7dfe4ab2cf0af8f412148b394d7b44a6a278a | [
"BSD-3-Clause"
] | null | null | null | """
Django settings for wagtail_template project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
# B... | 29.952991 | 97 | 0.709231 | """
Django settings for wagtail_template project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
# B... | 0 | 0 | 0 | 0 | 0 | 209 | 0 | 27 | 52 |
243d131c3f4dd5c382d0fd89e7593090e1cd85cd | 1,195 | py | Python | app/ples/templatetags/ples.py | misli/ples | 1cccd19946d460a232d79113465706472577729a | [
"BSD-3-Clause"
] | null | null | null | app/ples/templatetags/ples.py | misli/ples | 1cccd19946d460a232d79113465706472577729a | [
"BSD-3-Clause"
] | null | null | null | app/ples/templatetags/ples.py | misli/ples | 1cccd19946d460a232d79113465706472577729a | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement
from django import template
register = template.Library()
| 31.447368 | 125 | 0.681172 | from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement
from django import template
from ..models import Seat
register = template.Library()
@register.filter
def split(value):
return value.split()
@register.inclusion_tag('seat.html', takes_... | 0 | 933 | 0 | 0 | 0 | 0 | 0 | 4 | 69 |
2e6006e584a17825353e404af334a6f750425bb8 | 911 | py | Python | data/worker.py | suibex/fleonSide | 6bdf3b1cc2893984f7bff6715ec333e9c2cfcbae | [
"CC0-1.0"
] | 1 | 2022-01-17T22:46:02.000Z | 2022-01-17T22:46:02.000Z | data/worker.py | suibex/fleonSide | 6bdf3b1cc2893984f7bff6715ec333e9c2cfcbae | [
"CC0-1.0"
] | null | null | null | data/worker.py | suibex/fleonSide | 6bdf3b1cc2893984f7bff6715ec333e9c2cfcbae | [
"CC0-1.0"
] | null | null | null | import obd
conn = obd.OBD()
connect = obd.Async(fast=False)
speed=""
fueli=""
tem =""
connect.watch(obd.commands.INTAKE_TEMP,callback=get_temp)
connect.watch(obd.commands.FUEL_LEVEL,callback=get_fuel)
connect.watch(obd.commands.SPEED,callback=get_speed)
while True:
tempz = open("temp.txt","w+")
... | 15.706897 | 57 | 0.607025 | import threading
import os
import obd
from random import random
from pathlib import Path
conn = obd.OBD()
connect = obd.Async(fast=False)
speed=""
fueli=""
tem =""
def get_temp(t):
if not t.is_null():
tem=str(t.value)
if t.is_null():
tem=str(0)
def get_fuel(f):
if n... | 0 | 0 | 0 | 0 | 0 | 278 | 0 | -10 | 157 |
62d5047c4d6f556bef84c17d674c5de797b2b02f | 189 | py | Python | gym_mouse_lib/gym_mouse/__init__.py | TalHadad/yolov5_pytorch | 49d3e191cf79ca759d48fe027407eba30d6a2224 | [
"Apache-2.0"
] | null | null | null | gym_mouse_lib/gym_mouse/__init__.py | TalHadad/yolov5_pytorch | 49d3e191cf79ca759d48fe027407eba30d6a2224 | [
"Apache-2.0"
] | null | null | null | gym_mouse_lib/gym_mouse/__init__.py | TalHadad/yolov5_pytorch | 49d3e191cf79ca759d48fe027407eba30d6a2224 | [
"Apache-2.0"
] | null | null | null | # Core Library
import logging
# Third party
from gym.envs.registration import register
logger = logging.getLogger(__name__)
register(id="Mouse-v0", entry_point="gym_mouse.envs:MouseEnv") | 21 | 62 | 0.793651 | # Core Library
import logging
# Third party
from gym.envs.registration import register
logger = logging.getLogger(__name__)
register(id="Mouse-v0", entry_point="gym_mouse.envs:MouseEnv") | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
9af56af6b43afee1d873a3caf8046bff62a1f68a | 975 | py | Python | python/tree/N-aryTreePostorderTraversal.py | Nobodylesszb/LeetCode | 0e902f6bff4834a93ce64cf9c57fd64297e63523 | [
"MIT"
] | null | null | null | python/tree/N-aryTreePostorderTraversal.py | Nobodylesszb/LeetCode | 0e902f6bff4834a93ce64cf9c57fd64297e63523 | [
"MIT"
] | null | null | null | python/tree/N-aryTreePostorderTraversal.py | Nobodylesszb/LeetCode | 0e902f6bff4834a93ce64cf9c57fd64297e63523 | [
"MIT"
] | null | null | null | #Given an n-ary tree,
# return the postorder
# traversal of its nodes' values.
#Recursion is easy to implement and understand by definition
# https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(LRN)
| 26.351351 | 73 | 0.558974 | #Given an n-ary tree,
# return the postorder
# traversal of its nodes' values.
#Recursion is easy to implement and understand by definition
# https://en.wikipedia.org/wiki/Tree_traversal#Post-order_(LRN)
class Solution:
def postorder(self,root):
"""
:type:root :node
:rtype:list[int]
... | 0 | 0 | 0 | 744 | 0 | 0 | 0 | 0 | 22 |
741231e4e762030a801183488d2c8a85666d9f67 | 1,785 | py | Python | hardhat/recipes/python/__init__.py | stangelandcl/hardhat | 1ad0c5dec16728c0243023acb9594f435ef18f9c | [
"MIT"
] | null | null | null | hardhat/recipes/python/__init__.py | stangelandcl/hardhat | 1ad0c5dec16728c0243023acb9594f435ef18f9c | [
"MIT"
] | null | null | null | hardhat/recipes/python/__init__.py | stangelandcl/hardhat | 1ad0c5dec16728c0243023acb9594f435ef18f9c | [
"MIT"
] | null | null | null | import os
directory = os.path.dirname(__file__)
| 30.254237 | 79 | 0.547899 | import os
directory = os.path.dirname(__file__)
def load(settings):
from hardhat.util import load_recipes
recipes = load_recipes(directory, 'hardhat.recipes.python')
dependencies = [
# only one version of cython is needed so alias it
['cython', 'python3-cython'], # alias
['devpi... | 0 | 0 | 0 | 0 | 0 | 1,688 | 0 | 0 | 46 |
2051c4639387560e84e8d243f881177997e1a1f1 | 1,069 | py | Python | obfuscatorPage.py | andrewrx83/python2 | e70b7e1db3af575b4a522063c1bb6584f1a9275d | [
"MIT"
] | 26 | 2015-10-17T11:30:35.000Z | 2021-03-22T07:46:36.000Z | obfuscatorPage.py | andrewrx83/python2 | e70b7e1db3af575b4a522063c1bb6584f1a9275d | [
"MIT"
] | 10 | 2015-05-10T22:51:35.000Z | 2017-09-15T10:00:33.000Z | obfuscatorPage.py | andrewrx83/python2 | e70b7e1db3af575b4a522063c1bb6584f1a9275d | [
"MIT"
] | 16 | 2015-08-16T07:13:37.000Z | 2021-12-09T12:08:56.000Z | import os, sys
from twisted.python import log
from twisted.internet import reactor
if __name__ == "__main__":
log.startLogging(sys.stdout)
port = int(os.environ.get('PORT', 5000))
reactor.listenTCP(port, Application())
reactor.run()
| 28.891892 | 122 | 0.626754 | import os, sys, cyclone.web
import pyobf
from twisted.python import log
from twisted.internet import reactor
class IndexHandler(cyclone.web.RequestHandler):
def get(self):
self.render("index.html", original="", obfuscated="", originalLen=0, obfLen=0)
def post(self):
string = self.get_argument(... | 0 | 0 | 0 | 746 | 0 | 0 | 0 | 4 | 68 |
ceb1eeaa4872baf6c67cf9b0a43f35e96e62a66b | 1,569 | py | Python | babyshortener/utils/url.py | mnowotka/babyshortener | 079a95a715e0b30ca18265885d4d93a56553537a | [
"MIT"
] | 1 | 2019-09-20T07:36:15.000Z | 2019-09-20T07:36:15.000Z | babyshortener/utils/url.py | mnowotka/babyshortener | 079a95a715e0b30ca18265885d4d93a56553537a | [
"MIT"
] | 20 | 2018-10-05T09:00:23.000Z | 2022-03-31T01:53:32.000Z | babyshortener/utils/url.py | mnowotka/babyshortener | 079a95a715e0b30ca18265885d4d93a56553537a | [
"MIT"
] | null | null | null | """This file defines a URL validators based on Django ones.
"""
import re
# ----------------------------------------------------------------------------------------------------------------------
""" this regex is different from the one defined by Django because:
- in our case protocol is optional
- I decided t... | 37.357143 | 120 | 0.361377 | """This file defines a URL validators based on Django ones.
"""
import re
# ----------------------------------------------------------------------------------------------------------------------
""" this regex is different from the one defined by Django because:
- in our case protocol is optional
- I decided t... | 0 | 0 | 0 | 0 | 0 | 94 | 0 | 0 | 46 |
444bde82d6fd488d23f00861a4f896b303889cbc | 7,111 | py | Python | war.py | Feldari/cardgame-war | 895082a81c78f7643b15c057909a2a4505d42d27 | [
"MIT"
] | null | null | null | war.py | Feldari/cardgame-war | 895082a81c78f7643b15c057909a2a4505d42d27 | [
"MIT"
] | null | null | null | war.py | Feldari/cardgame-war | 895082a81c78f7643b15c057909a2a4505d42d27 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3.6
import random
def init():
'''
This builds the deck to draw from.
This runs at the beginning of the program then shoud only be run
to start a new game.
'''
# These are the possible face values and suits for the cards.
cardfaces = ("A","K","Q","J","10","9","8","7",... | 30.650862 | 78 | 0.50682 | #!/usr/bin/env python3.6
import random
def init():
'''
This builds the deck to draw from.
This runs at the beginning of the program then shoud only be run
to start a new game.
'''
# These are the possible face values and suits for the cards.
cardfaces = ("A","K","Q","J","10","9","8","7",... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
0221ddaeac067a10aac025cefb09e848688bdbb3 | 3,467 | py | Python | wearebeautiful/database.py | wearebeautiful/wearebeautiful.info | ba93138f94079b89d7f9d89328509e201837bd07 | [
"CC0-1.0"
] | 1 | 2019-07-20T10:17:14.000Z | 2019-07-20T10:17:14.000Z | wearebeautiful/database.py | wearebeautiful/wearebeautiful-tools | ba93138f94079b89d7f9d89328509e201837bd07 | [
"CC0-1.0"
] | 26 | 2020-02-17T17:42:49.000Z | 2020-04-17T21:24:52.000Z | wearebeautiful/database.py | wearebeautiful/wearebeautiful-tools | ba93138f94079b89d7f9d89328509e201837bd07 | [
"CC0-1.0"
] | 1 | 2019-08-14T19:23:33.000Z | 2019-08-14T19:23:33.000Z |
DB_FILE = "wab-models.db"
MIN_SURFACE_MED_SIZE = 8 * 1024 * 1024
MAX_SURFACE_MED_SIZE = 12 * 1024 * 1024
MIN_SURFACE_LOW_SIZE = 1.5 * 1024 * 1024
MAX_SURFACE_LOW_SIZE = 5 * 1024 * 1024
| 36.494737 | 160 | 0.590424 | import os
import json
import shutil
from peewee import SqliteDatabase
from wearebeautiful.db_model import DBModel, db, create_from_manifest
from wearebeautiful.manifest import validate_manifest
import config
DB_FILE = "wab-models.db"
MIN_SURFACE_MED_SIZE = 8 * 1024 * 1024
MAX_SURFACE_MED_SIZE = 12 * 1024 * 1024
MIN_S... | 0 | 0 | 0 | 0 | 0 | 2,997 | 0 | 54 | 224 |
d87d8fc47074e1ce777b15fdf6a6fb91c0181af1 | 733 | py | Python | stephen/week2.py | kanglicheng/learn-python-2020 | e5b2f0945f123763595bff825af59855d616a100 | [
"Unlicense"
] | null | null | null | stephen/week2.py | kanglicheng/learn-python-2020 | e5b2f0945f123763595bff825af59855d616a100 | [
"Unlicense"
] | null | null | null | stephen/week2.py | kanglicheng/learn-python-2020 | e5b2f0945f123763595bff825af59855d616a100 | [
"Unlicense"
] | null | null | null |
# print(pig_latin("Python"))
# print(pig_latin("computer"))
# print(pig_latin(("air")))
# print(ubbi_dubbi())
get_running_avg()
| 18.794872 | 42 | 0.572988 | def pig_latin(word):
vowels = "aeiou"
if not word:
return None
if word[0] in vowels:
return word+"way"
else:
new_word = [word[1:]+word[0]+"ay"]
return "".join(new_word)
# print(pig_latin("Python"))
# print(pig_latin("computer"))
# print(pig_latin(("air")))
def ubbi_du... | 0 | 0 | 0 | 0 | 0 | 529 | 0 | 0 | 68 |
d4423723c5ded922dbd098a0b6a015236bed2606 | 2,490 | py | Python | app.py | behrad-kzm/LocationBrain | 44ef5e03cc9b240bfabad5c3c14635ef812a39ae | [
"MIT"
] | null | null | null | app.py | behrad-kzm/LocationBrain | 44ef5e03cc9b240bfabad5c3c14635ef812a39ae | [
"MIT"
] | null | null | null | app.py | behrad-kzm/LocationBrain | 44ef5e03cc9b240bfabad5c3c14635ef812a39ae | [
"MIT"
] | null | null | null | from flask import Flask
app = Flask(__name__)
if __name__ == '__main__':
app.run()
| 31.923077 | 76 | 0.542972 | from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
print(__doc__)
from time import time
import numpy as np
from scipy import ndimage
from matplotlib import pyplot as plt
from sklearn import manifold, datasets
X, y = datasets.load_digits(return_X_y=True)
... | 0 | 2,376 | 0 | 0 | 0 | 0 | 0 | 0 | 23 |
23a910acf49e30a5a8a9310c45d430a0c2df692a | 130 | py | Python | gastrotourism/accounts/admin.py | fallprojects/gastrotourism | 79dc3fbeda9b9d2175fca6590369b003d7a10c36 | [
"MIT"
] | null | null | null | gastrotourism/accounts/admin.py | fallprojects/gastrotourism | 79dc3fbeda9b9d2175fca6590369b003d7a10c36 | [
"MIT"
] | null | null | null | gastrotourism/accounts/admin.py | fallprojects/gastrotourism | 79dc3fbeda9b9d2175fca6590369b003d7a10c36 | [
"MIT"
] | null | null | null | from django.contrib import admin
# Register your models here.
from accounts.models import Customer
admin.site.register(Customer) | 21.666667 | 36 | 0.823077 | from django.contrib import admin
# Register your models here.
from accounts.models import Customer
admin.site.register(Customer) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
aeb22914ed6e50a3574958d1d84e46aeb1996420 | 3,596 | py | Python | stuff.py | karol-prz/predictor | 2774fe2a88a9bf5f7aa58f884cdcf879182c64c7 | [
"MIT"
] | null | null | null | stuff.py | karol-prz/predictor | 2774fe2a88a9bf5f7aa58f884cdcf879182c64c7 | [
"MIT"
] | null | null | null | stuff.py | karol-prz/predictor | 2774fe2a88a9bf5f7aa58f884cdcf879182c64c7 | [
"MIT"
] | null | null | null |
'''
def compare(file1, file2):
f1 = open(file1, 'r')
f2 = open(file2, 'r')
right_counter = 0
wrong_lines = []
for i in range(50):
r1 = f1.readline()
r2 = f2.readline()
r1 = r1.strip('\n')
r2 = r2.strip('\n')
if r1[-1:] == r2[-1:]:
right_counter += 1
else:
wrong_lines.append(i)
print('Wrong lin... | 21.793939 | 148 | 0.630423 |
def get_team_names(deatils):
outfile = open('team_names.txt', 'a+')
teams = []
for game in details:
for i in ['home-team', 'away-team']:
if game[i] not in teams:
teams.append(game[i])
outfile.write('\n'.join(teams))
outfile.close()
def sort_team_names():
file = open('team_names.txt', 'r')
teams = fi... | 0 | 0 | 0 | 0 | 0 | 2,902 | 0 | 0 | 184 |
5ccdda389df3723602d93a8ee43208eb6dde9c1e | 125 | py | Python | eyed/db/__init__.py | ThousandMileEye/Eye | b0eca371fed5e01353ebddf7e4c400927decf0d2 | [
"Apache-2.0"
] | null | null | null | eyed/db/__init__.py | ThousandMileEye/Eye | b0eca371fed5e01353ebddf7e4c400927decf0d2 | [
"Apache-2.0"
] | 55 | 2017-12-21T15:20:36.000Z | 2019-01-20T02:49:41.000Z | eyed/db/__init__.py | ThousandMileEye/Eye | b0eca371fed5e01353ebddf7e4c400927decf0d2 | [
"Apache-2.0"
] | 3 | 2018-05-18T09:02:36.000Z | 2019-12-29T10:27:44.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from db import SessionFactory, Engine
__all__ = [
SessionFactory,
Engine
]
| 12.5 | 37 | 0.672 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from db import SessionFactory, Engine
__all__ = [
SessionFactory,
Engine
]
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
15464d100b378bacafa095cea5a8e320fa5b16fc | 2,596 | py | Python | core2pkgs/core2pkgs/config.py | DmitryRyumin/pkgs | 8d0b1e03495f2b4d6da96664a222fecac8d98e74 | [
"MIT"
] | 2 | 2019-09-19T13:22:48.000Z | 2020-01-13T17:03:46.000Z | core2pkgs/core2pkgs/config.py | DmitryRyumin/pkgs | 8d0b1e03495f2b4d6da96664a222fecac8d98e74 | [
"MIT"
] | null | null | null | core2pkgs/core2pkgs/config.py | DmitryRyumin/pkgs | 8d0b1e03495f2b4d6da96664a222fecac8d98e74 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
# ######################################################################################################################
#
# ######################################################################################################################
# ########... | 34.613333 | 120 | 0.277735 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Глобальный файл настроек
"""
# ######################################################################################################################
# Класс для выделения текста
# ######################################################################################... | 596 | 168 | 0 | 1,529 | 0 | 0 | 0 | 0 | 44 |
4ea1a7e3af7017746226259f4bbb840efd076b0c | 5,261 | py | Python | RaspberryPi/main.py | effx13/ArduinoRobotArm_MDP | 5c11829766b8b7134aabd8902ecc698998c25b84 | [
"MIT"
] | 2 | 2021-11-01T11:02:44.000Z | 2021-12-01T05:40:24.000Z | RaspberryPi/main.py | effx13/ArduinoRobotArm_MDP | 5c11829766b8b7134aabd8902ecc698998c25b84 | [
"MIT"
] | 1 | 2021-12-01T05:33:16.000Z | 2021-12-01T05:33:16.000Z | RaspberryPi/main.py | effx13/ArduinoRobotArm_MDP | 5c11829766b8b7134aabd8902ecc698998c25b84 | [
"MIT"
] | null | null | null | import cv2
import imutils
import time
import threading
import serial
import RPi.GPIO as GPIO
# ------------------- -------------------
port = "/dev/ttyACM0"
reset_timer_seconds = -1
angles = [150, 120, 130]
arduino = serial.Serial(port, 115200, timeout=1)
haarcascade_file = '/home/pi/ArduinoRobotArm_MDP/RaspberryPi/h... | 31.315476 | 110 | 0.547234 | import cv2
import imutils
import time
import threading
import serial
import RPi.GPIO as GPIO
from bluetooth import *
from serial.serialutil import SerialException
# -------------------변수 선언 부분-------------------
port = "/dev/ttyACM0"
reset_timer_seconds = -1
angles = [150, 120, 130]
arduino = serial.Serial(port, 11520... | 657 | 0 | 0 | 0 | 0 | 2,916 | 0 | 26 | 157 |
d11b9271af6be6db5151310a6e7b78b927945e06 | 556 | py | Python | src/pytypes/tests/test_alnum_filter.py | tonybaloney/onefuzz | e0f2e9ed5aae006e0054387de7a0ff8c83c8f722 | [
"MIT"
] | 2,692 | 2020-09-15T17:54:21.000Z | 2022-03-31T11:58:57.000Z | src/pytypes/tests/test_alnum_filter.py | tonybaloney/onefuzz | e0f2e9ed5aae006e0054387de7a0ff8c83c8f722 | [
"MIT"
] | 980 | 2020-09-18T18:23:01.000Z | 2022-03-30T22:20:43.000Z | src/pytypes/tests/test_alnum_filter.py | tonybaloney/onefuzz | e0f2e9ed5aae006e0054387de7a0ff8c83c8f722 | [
"MIT"
] | 177 | 2020-09-16T00:10:56.000Z | 2022-03-30T21:18:10.000Z | #!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest
if __name__ == "__main__":
unittest.main()
| 23.166667 | 76 | 0.638489 | #!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest
from onefuzztypes.validators import check_alnum_dash
class TestFilter(unittest.TestCase):
def test_filter(self) -> None:
check_alnum_dash("abc-")
check_alnum_dash("-abc12A")
... | 0 | 0 | 0 | 315 | 0 | 0 | 0 | 31 | 46 |
df80bfdf494e35c26f3d249e25ba71884bd5df77 | 5,554 | py | Python | quotequail/__init__.py | noufalsalim/quotequail | 400d5105cf5104f20ffb3f9b401b71ec088b5838 | [
"MIT"
] | 35 | 2015-07-21T03:37:37.000Z | 2022-03-14T13:22:40.000Z | quotequail/__init__.py | noufalsalim/quotequail | 400d5105cf5104f20ffb3f9b401b71ec088b5838 | [
"MIT"
] | 18 | 2015-11-19T00:52:17.000Z | 2022-02-02T08:03:26.000Z | quotequail/__init__.py | noufalsalim/quotequail | 400d5105cf5104f20ffb3f9b401b71ec088b5838 | [
"MIT"
] | 24 | 2016-01-27T10:16:00.000Z | 2022-02-26T23:44:29.000Z | # -*- coding: utf-8 -*-
# quotequail
# a library that identifies quoted text in email messages
from . import _internal
__all__ = ['quote', 'quote_html', 'unwrap', 'unwrap_html']
def quote(text, limit=1000):
"""
Takes a plain text message as an argument, returns a list of tuples. The
first argument of th... | 32.863905 | 88 | 0.620994 | # -*- coding: utf-8 -*-
# quotequail
# a library that identifies quoted text in email messages
import re
from . import _internal
__all__ = ['quote', 'quote_html', 'unwrap', 'unwrap_html']
def quote(text, limit=1000):
"""
Takes a plain text message as an argument, returns a list of tuples. The
first arg... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | -12 | 23 |
6a4c6a5ead1b8e02e2e5f40e25c2514b6405df58 | 7,876 | py | Python | disturbance/settings.py | thakurpriya1990/disturbance | 47f9ce5ae5f1b02d97ace11f1041e96daf7e4556 | [
"Apache-2.0"
] | 1 | 2020-06-30T04:47:42.000Z | 2020-06-30T04:47:42.000Z | disturbance/settings.py | thakurpriya1990/disturbance | 47f9ce5ae5f1b02d97ace11f1041e96daf7e4556 | [
"Apache-2.0"
] | 3 | 2021-05-12T00:05:54.000Z | 2022-03-02T10:37:22.000Z | disturbance/settings.py | thakurpriya1990/disturbance | 47f9ce5ae5f1b02d97ace11f1041e96daf7e4556 | [
"Apache-2.0"
] | 1 | 2020-06-16T05:51:52.000Z | 2020-06-16T05:51:52.000Z | from django.core.exceptions import ImproperlyConfigured
import os, hashlib
import confy
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
confy.read_environment_file(BASE_DIR+"/.env")
os.environ.setdefault("BASE_DIR", BASE_DIR)
ROOT_URLCONF = 'disturbance.urls'
SITE_ID = 1
DEPT_DOMAINS = env('DE... | 36.462963 | 128 | 0.734002 | from django.core.exceptions import ImproperlyConfigured
import os, hashlib
import confy
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
confy.read_environment_file(BASE_DIR+"/.env")
os.environ.setdefault("BASE_DIR", BASE_DIR)
from ledger.settings_base import *
ROOT_URLCONF = 'disturbance.urls... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 23 |
871940d70a528cc5f3e9d07b3130d476a0ac2b28 | 1,928 | py | Python | provision/cg.py | mkosterin/snr_phones_autoprovision_config_generator | c21cf91fcebd5f17a59cf5f30faf2d0ca7fffcc3 | [
"MIT"
] | null | null | null | provision/cg.py | mkosterin/snr_phones_autoprovision_config_generator | c21cf91fcebd5f17a59cf5f30faf2d0ca7fffcc3 | [
"MIT"
] | null | null | null | provision/cg.py | mkosterin/snr_phones_autoprovision_config_generator | c21cf91fcebd5f17a59cf5f30faf2d0ca7fffcc3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from jinja2 import Environment, FileSystemLoader
baseDir = "c:\\provision"
# which extension number we should start
start_ext = 821
extensionHeader = """#cid_number,transfer,mailbox,type,qualify,hasdirectory,call-limit,host,context,fullname,secret,hasvoicemail,vmsecret,email,delete,... | 32.677966 | 318 | 0.645747 | # -*- coding: utf-8 -*-
import string
import random
from jinja2 import Template, Environment, FileSystemLoader
def password():
alphabet = string.ascii_letters + string.digits
while True:
password = ''.join(random.choice(alphabet) for i in range(10))
if (any(c.islower() for c in passw... | 0 | 0 | 0 | 0 | 0 | 343 | 0 | -6 | 71 |
044676a8ff601efa4be0c7cc2f74a9175441a1bb | 1,352 | py | Python | alerta/views/__init__.py | smbambling/alerta | 1b3c3888b67ac4db48ef5eb9dcd704ac0c5aecb1 | [
"Apache-2.0"
] | 1,233 | 2017-11-01T00:29:12.000Z | 2022-03-29T04:13:09.000Z | alerta/views/__init__.py | smbambling/alerta | 1b3c3888b67ac4db48ef5eb9dcd704ac0c5aecb1 | [
"Apache-2.0"
] | 760 | 2017-10-27T20:33:41.000Z | 2022-03-28T17:01:41.000Z | alerta/views/__init__.py | smbambling/alerta | 1b3c3888b67ac4db48ef5eb9dcd704ac0c5aecb1 | [
"Apache-2.0"
] | 238 | 2017-11-02T14:58:15.000Z | 2022-03-29T03:59:20.000Z | from flask import Blueprint
api = Blueprint('api', __name__)
try:
except ImportError:
pass
| 28.765957 | 133 | 0.642012 | from flask import Blueprint, current_app, jsonify, request
from alerta.app import custom_webhooks
from alerta.exceptions import ApiError
from alerta.utils.response import absolute_url
api = Blueprint('api', __name__)
from . import alerts, blackouts, config, customers, groups, heartbeats, keys, oembed, permissions, u... | 0 | 870 | 0 | 0 | 0 | 0 | 0 | 170 | 212 |
a3a6ca3d60b2fa60a87dfa7d07a083ca5ad28d60 | 19,506 | py | Python | tools/cocos2d-console/plugins/project_compile/build_android.py | kinzhang/cocos2d-js-v3.2 | 530c6fe1345aa31fbd94d0ec191071a6db23820d | [
"MIT"
] | null | null | null | tools/cocos2d-console/plugins/project_compile/build_android.py | kinzhang/cocos2d-js-v3.2 | 530c6fe1345aa31fbd94d0ec191071a6db23820d | [
"MIT"
] | null | null | null | tools/cocos2d-console/plugins/project_compile/build_android.py | kinzhang/cocos2d-js-v3.2 | 530c6fe1345aa31fbd94d0ec191071a6db23820d | [
"MIT"
] | null | null | null | #!/usr/bin/python
# build_native.py
# Build native codes
import os
BUILD_CFIG_FILE="build-cfg.json"
| 39.889571 | 186 | 0.618886 | #!/usr/bin/python
# build_native.py
# Build native codes
import sys
import os, os.path
import shutil
from optparse import OptionParser
import cocos
import cocos_project
import json
import re
from xml.dom import minidom
import project_compile
BUILD_CFIG_FILE="build-cfg.json"
class AndroidBuilder(object):
CFG_K... | 0 | 0 | 0 | 19,204 | 0 | 0 | 0 | -23 | 223 |
a15b4093e656e40e94de6847d3082d5d816ef4dd | 164 | py | Python | WEEKS/CD_Sata-Structures/_MISC/misc-examples/tuples.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/tuples.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/tuples.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | l1 = [1, 3, 5, 7, 9] # list mutable (read write)
t1 = (1, 3, 5, 7, 9) # tuple imutable (read only)
f(l1)
print(l1)
f(t1)
print(t1)
| 12.615385 | 50 | 0.542683 | l1 = [1, 3, 5, 7, 9] # list mutable (read write)
t1 = (1, 3, 5, 7, 9) # tuple imutable (read only)
def f(x):
x.append(29)
f(l1)
print(l1)
f(t1)
print(t1)
| 0 | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 23 |
bc2349ff8bae24f07701d461a1fd2e888e76d0b2 | 1,629 | py | Python | stereo/dataset/DS.py | Owl-AI/Reversing | a4321642ccad6e7c2f4c71bcb960ee9c5edf5ed8 | [
"Apache-2.0"
] | 41 | 2020-07-06T13:02:44.000Z | 2022-03-23T04:39:19.000Z | stereo/dataset/DS.py | Owl-AI/Reversing | a4321642ccad6e7c2f4c71bcb960ee9c5edf5ed8 | [
"Apache-2.0"
] | 19 | 2020-09-23T18:40:29.000Z | 2022-02-10T02:05:39.000Z | stereo/dataset/DS.py | Owl-AI/Reversing | a4321642ccad6e7c2f4c71bcb960ee9c5edf5ed8 | [
"Apache-2.0"
] | 6 | 2020-12-03T09:49:58.000Z | 2022-02-18T12:18:34.000Z | # Copyright 2020 Filippo Aleotti, Fabio Tosi, Li Zhang, Matteo Poggi, Stefano Mattoccia
#
# 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
#
# ... | 29.618182 | 87 | 0.679558 | # Copyright 2020 Filippo Aleotti, Fabio Tosi, Li Zhang, Matteo Poggi, Stefano Mattoccia
#
# 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
ee9ed6c949b34da36c66762654aacec08e5ca418 | 1,009 | py | Python | scc_home/views.py | supercooledcreations/supercooledcreations | e4fcbbfd1eb60d808273d16c1de0ffb81ac33e49 | [
"MIT"
] | null | null | null | scc_home/views.py | supercooledcreations/supercooledcreations | e4fcbbfd1eb60d808273d16c1de0ffb81ac33e49 | [
"MIT"
] | null | null | null | scc_home/views.py | supercooledcreations/supercooledcreations | e4fcbbfd1eb60d808273d16c1de0ffb81ac33e49 | [
"MIT"
] | null | null | null | # Import #
# Django
# App
# Views #
# Metrics # | 24.609756 | 66 | 0.693756 | # Import #
# Django
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.views import View
from django.urls import reverse
from django.utils import timezone
# App
from .forms import BookmarkForm
from .models import Bookma... | 0 | 0 | 0 | 641 | 0 | 0 | 0 | 120 | 198 |
35580bce47e7ce13de691232e814794292ae6419 | 4,100 | py | Python | Engine/src/simulation/benchmarker/model_benchmarker.py | xapharius/HadoopML | c0129f298007ca89b538eb1a3800f991141ba361 | [
"MIT"
] | 2 | 2018-02-05T12:41:31.000Z | 2018-11-23T04:13:13.000Z | Engine/src/simulation/benchmarker/model_benchmarker.py | xapharius/HadoopML | c0129f298007ca89b538eb1a3800f991141ba361 | [
"MIT"
] | null | null | null | Engine/src/simulation/benchmarker/model_benchmarker.py | xapharius/HadoopML | c0129f298007ca89b538eb1a3800f991141ba361 | [
"MIT"
] | null | null | null | '''
Created on Apr 21, 2015
@author: xapharius
'''
| 42.708333 | 129 | 0.706098 | '''
Created on Apr 21, 2015
@author: xapharius
'''
import numpy as np
import pandas as pd
from datahandler.numerical2.numerical_data_handler import NumericalDataHandler
from sklearn.linear_model.logistic import LogisticRegression
from factory.algorithm_factory import AlgorithmFactory
from factory.homogenous_factory ... | 0 | 0 | 0 | 3,336 | 0 | 0 | 0 | 411 | 291 |
dd650dd25a31e2850c06900e6356f7ef7f9c2098 | 928 | py | Python | ch06/06_06_fav-langs.py | remotephone/pythoncrashcourse | 837d05c5ef4976621bd2206328254749a71d60ff | [
"Apache-2.0"
] | null | null | null | ch06/06_06_fav-langs.py | remotephone/pythoncrashcourse | 837d05c5ef4976621bd2206328254749a71d60ff | [
"Apache-2.0"
] | null | null | null | ch06/06_06_fav-langs.py | remotephone/pythoncrashcourse | 837d05c5ef4976621bd2206328254749a71d60ff | [
"Apache-2.0"
] | null | null | null | favorite_languages = {
'jen': 'python',
'sarah': 'c',
'edward': 'ruby',
'phil': 'python',
}
for name, language in favorite_languages.items():
print(name.title() + "'s favorite language is " +
language.title() + ".")
for name in favorite_languages.keys():
print(name.title())
friend... | 25.777778 | 59 | 0.636853 | favorite_languages = {
'jen': 'python',
'sarah': 'c',
'edward': 'ruby',
'phil': 'python',
}
for name, language in favorite_languages.items():
print(name.title() + "'s favorite language is " +
language.title() + ".")
for name in favorite_languages.keys():
print(name.title())
friend... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1ac9df902aa5e4f7697bbdceacd57712c28d228c | 15,340 | py | Python | python/dsbox/JobManager/DistributedJobManager.py | usc-isi-i2/dsbox-ta2 | 85e0e8f5bbda052fa77cb98f4eef1f4b50909fd2 | [
"MIT"
] | 7 | 2018-05-10T22:19:44.000Z | 2020-07-21T07:28:39.000Z | python/dsbox/JobManager/DistributedJobManager.py | usc-isi-i2/dsbox-ta2 | 85e0e8f5bbda052fa77cb98f4eef1f4b50909fd2 | [
"MIT"
] | 187 | 2018-04-13T17:19:24.000Z | 2020-04-21T00:41:15.000Z | python/dsbox/JobManager/DistributedJobManager.py | usc-isi-i2/dsbox-ta2 | 85e0e8f5bbda052fa77cb98f4eef1f4b50909fd2 | [
"MIT"
] | 7 | 2018-07-10T00:14:07.000Z | 2019-07-25T17:59:44.000Z | import logging
from multiprocessing import Manager
_logger = logging.getLogger(__name__)
# used to save all PID of workers created
m = Manager()
_current_work_pids = m.list()
| 35.591647 | 110 | 0.585854 | import copy
import os
import logging
import pickle
import psutil
import time
import threading
import typing
from enum import Enum
from math import ceil
from multiprocessing import Pool, Queue, Manager, current_process
from threading import Timer
_logger = logging.getLogger(__name__)
# used to save all PID of workers ... | 0 | 5,982 | 0 | 8,892 | 0 | 0 | 0 | -25 | 313 |
4d0daa960362632a61b5cf757503f182df9a344c | 15,588 | py | Python | razor/passes.py | MuhammadAbuBakar95/OCCAM | 4ffec0043caa6003288520a42838a0226eb6cfa3 | [
"BSD-3-Clause"
] | null | null | null | razor/passes.py | MuhammadAbuBakar95/OCCAM | 4ffec0043caa6003288520a42838a0226eb6cfa3 | [
"BSD-3-Clause"
] | null | null | null | razor/passes.py | MuhammadAbuBakar95/OCCAM | 4ffec0043caa6003288520a42838a0226eb6cfa3 | [
"BSD-3-Clause"
] | null | null | null | """
OCCAM
Copyright (c) 2011-2017, SRI International
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 con... | 36.420561 | 96 | 0.624391 | """
OCCAM
Copyright (c) 2011-2017, SRI International
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 con... | 0 | 0 | 0 | 0 | 0 | 127 | 0 | 0 | 31 |
a371f4fac06296e177e959b547db9d31e5eb8257 | 24,893 | py | Python | GChartWrapper/GChart.py | dhilipsiva/google-chartwrapper | 3769aecbef6c83b6cd93ee72ece478ffe433ac57 | [
"BSD-3-Clause"
] | null | null | null | GChartWrapper/GChart.py | dhilipsiva/google-chartwrapper | 3769aecbef6c83b6cd93ee72ece478ffe433ac57 | [
"BSD-3-Clause"
] | 1 | 2019-01-14T05:09:15.000Z | 2019-01-14T05:09:15.000Z | GChartWrapper/GChart.py | dhilipsiva/google-chartwrapper | 3769aecbef6c83b6cd93ee72ece478ffe433ac57 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
################################################################################
# GChartWrapper - v0.8
# Copyright (C) 2009 Justin Quick <justquick@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ver... | 32.328571 | 89 | 0.528582 | # -*- coding: utf-8 -*-
################################################################################
# GChartWrapper - v0.8
# Copyright (C) 2009 Justin Quick <justquick@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License ver... | 0 | 589 | 0 | 21,292 | 311 | 0 | 0 | 37 | 659 |
5f42ca913e67b584e2439069cf41f85b536f737a | 1,166 | py | Python | template.py | franbeep/TWDM-PON-Sim | c34f626c737f03d280bb96fd1dbd4eaa291383e3 | [
"MIT"
] | 1 | 2021-11-19T07:20:09.000Z | 2021-11-19T07:20:09.000Z | template.py | franbeep/TWDM-PON-Sim | c34f626c737f03d280bb96fd1dbd4eaa291383e3 | [
"MIT"
] | null | null | null | template.py | franbeep/TWDM-PON-Sim | c34f626c737f03d280bb96fd1dbd4eaa291383e3 | [
"MIT"
] | null | null | null | import sim
# seed
sim.random.seed(13)
# environment
env = sim.simpy.Environment()
# writer
# packet_w = Writer("packet_", start="# id src init_time waited_time freq processed_time\n")
# default values
sim.tg_default_size = lambda x: 5000
sim.tg_default_dist = lambda x: 1
sim.ONU_consumption = lambda x: 15
sim.PN_co... | 18.507937 | 92 | 0.678388 | import sim
# seed
sim.random.seed(13)
# environment
env = sim.simpy.Environment()
# writer
# packet_w = Writer("packet_", start="# id src init_time waited_time freq processed_time\n")
# default values
sim.tg_default_size = lambda x: 5000
sim.tg_default_dist = lambda x: 1
sim.ONU_consumption = lambda x: 15
sim.PN_co... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
67cea391e6faee05921bb6b7f027d954dc5deb2b | 3,186 | py | Python | train.py | team-eyespace/show-tell-api | b9947091083174e5469fcf3cf3079fabd73789dd | [
"MIT"
] | null | null | null | train.py | team-eyespace/show-tell-api | b9947091083174e5469fcf3cf3079fabd73789dd | [
"MIT"
] | 20 | 2019-11-28T06:38:26.000Z | 2022-03-12T00:41:52.000Z | train.py | team-eyespace/show-tell-api | b9947091083174e5469fcf3cf3079fabd73789dd | [
"MIT"
] | 1 | 2019-12-22T08:58:30.000Z | 2019-12-22T08:58:30.000Z | '''
File to train the NIC model, based on the paper:
https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Vinyals_Show_and_Tell_2015_CVPR_paper.pdf
'''
if __name__ == "__main__":
dict_dir = './datasets/features_dict.pkl'
train_dir = './datasets/Flickr8k_text/Flickr_8k.trainImages.txt'
dev_... | 40.846154 | 115 | 0.710609 | '''
File to train the NIC model, based on the paper:
https://www.cv-foundation.org/openaccess/content_cvpr_2015/papers/Vinyals_Show_and_Tell_2015_CVPR_paper.pdf
'''
from keras.callbacks import ModelCheckpoint
from keras.models import Model, load_model
from keras.optimizers import Adam
from keras.utils import plot_mod... | 0 | 0 | 0 | 0 | 0 | 2,035 | 0 | 134 | 202 |
d4f988f814604af80219f450450b3d48b4a82f8f | 2,034 | py | Python | sktime/performance_metrics/tests/test_metrics_classes.py | khrapovs/sktime | 1589d007ef5dbcdc1f42f2c8278919ebed516358 | [
"BSD-3-Clause"
] | 1 | 2021-12-22T02:45:39.000Z | 2021-12-22T02:45:39.000Z | sktime/performance_metrics/tests/test_metrics_classes.py | khrapovs/sktime | 1589d007ef5dbcdc1f42f2c8278919ebed516358 | [
"BSD-3-Clause"
] | null | null | null | sktime/performance_metrics/tests/test_metrics_classes.py | khrapovs/sktime | 1589d007ef5dbcdc1f42f2c8278919ebed516358 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tests for classes in _classes module."""
from inspect import getmembers, isclass
from sktime.performance_metrics.forecasting import _classes
metric_classes = getmembers(_classes, isclass)
exclude_starts_with = ("_", "Base")
metric_classes = [x for x in metric_classes if not x[0].startswith... | 32.806452 | 88 | 0.701573 | # -*- coding: utf-8 -*-
"""Tests for classes in _classes module."""
from inspect import getmembers, isclass
import numpy as np
import pandas as pd
import pytest
from sktime.performance_metrics.forecasting import _classes
from sktime.utils._testing.series import _make_series
metric_classes = getmembers(_classes, iscl... | 0 | 1,520 | 0 | 0 | 0 | 0 | 0 | 19 | 112 |
19da141c48b7413d93cb25e65307a76b60c3d964 | 3,952 | py | Python | 4 term/MNA/Lab 3/main.py | mrojaczy/Labs | 21cd2ad3ddf8fa3b64cf253d147a4a04ad0667ab | [
"Apache-2.0"
] | 1 | 2020-03-15T17:11:23.000Z | 2020-03-15T17:11:23.000Z | 4 term/MNA/Lab 3/main.py | Asphobel/Labs | ee827143b32b691dd7736ba4888a4a9625b4694a | [
"Apache-2.0"
] | null | null | null | 4 term/MNA/Lab 3/main.py | Asphobel/Labs | ee827143b32b691dd7736ba4888a4a9625b4694a | [
"Apache-2.0"
] | null | null | null | import numpy as np
if __name__ == '__main__':
n = 4
matrixA = np.array([[3.738, 0.195, 0.275, 0.136],
[0.519, 5.002, 0.405, 0.283],
[0.306, 0.381, 4.812, 0.418],
[0.272, 0.142, 0.314, 3.935]])
matrixB = np.array([0.815, 0.191, 0.42... | 35.603604 | 88 | 0.527328 | import numpy as np
import numpy.linalg as la
import math
def squareRootMethod(n, matrixA, matrixB):
extendedMatrix = np.column_stack((matrixA, matrixB))
if la.matrix_rank(extendedMatrix) != la.matrix_rank(matrixA):
print("Система не имеет решений")
return
elif la.matrix_rank(matrixA) != n:... | 480 | 0 | 0 | 0 | 0 | 2,590 | 0 | -6 | 113 |
a4e1c2123e1d9a7067b7fb0d3a9954f49505f739 | 9,003 | py | Python | popnn_torch.py | bhardwajRahul/Gesture-Recognition | e4722ecb58e5c65f34f92a21058eae81ed3c84e0 | [
"MIT"
] | 102 | 2018-11-03T03:39:10.000Z | 2022-03-31T03:11:54.000Z | popnn_torch.py | shuren007/Gesture-Recognition | e4722ecb58e5c65f34f92a21058eae81ed3c84e0 | [
"MIT"
] | 2 | 2019-06-14T14:03:49.000Z | 2020-04-20T12:14:27.000Z | popnn_torch.py | shuren007/Gesture-Recognition | e4722ecb58e5c65f34f92a21058eae81ed3c84e0 | [
"MIT"
] | 34 | 2018-12-13T23:20:53.000Z | 2022-01-09T16:37:34.000Z | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
''' Imports '''
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
import argparse
import random
import numpy as np
from tqdm import tqdm
import matplotlib.pyplot as plt
import matplotlib.ticker as t... | 34.494253 | 232 | 0.721315 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
''' Imports '''
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR
import argparse
import random
import numpy as np
import time
from tqdm import tqdm
import matplotlib... | 0 | 0 | 0 | 1,051 | 0 | 0 | 0 | -12 | 89 |
f167c13fb9a6fa79b72ac03dc561d070112c7b79 | 1,214 | py | Python | 226.invert-binary-tree.py | windard/leeeeee | 0107a5f95746592ca4fe78d2b5875cf65b1910e7 | [
"MIT"
] | null | null | null | 226.invert-binary-tree.py | windard/leeeeee | 0107a5f95746592ca4fe78d2b5875cf65b1910e7 | [
"MIT"
] | null | null | null | 226.invert-binary-tree.py | windard/leeeeee | 0107a5f95746592ca4fe78d2b5875cf65b1910e7 | [
"MIT"
] | null | null | null | #
# @lc app=leetcode id=226 lang=python
#
# [226] Invert Binary Tree
#
# https://leetcode.com/problems/invert-binary-tree/description/
#
# algorithms
# Easy (56.72%)
# Total Accepted: 297.1K
# Total Submissions: 522.5K
# Testcase Example: '[4,2,7,1,3,6,9]'
#
# Invert a binary tree.
#
# Example:
#
# Input:
#
#
# ... | 18.393939 | 77 | 0.553542 | #
# @lc app=leetcode id=226 lang=python
#
# [226] Invert Binary Tree
#
# https://leetcode.com/problems/invert-binary-tree/description/
#
# algorithms
# Easy (56.72%)
# Total Accepted: 297.1K
# Total Submissions: 522.5K
# Testcase Example: '[4,2,7,1,3,6,9]'
#
# Invert a binary tree.
#
# Example:
#
# Input:
#
#
# ... | 27 | 0 | 0 | 351 | 0 | 0 | 0 | 0 | 23 |
ea3a96f8d11422a1ee7342ce72973227c97bad62 | 476 | py | Python | Blackjack/functions.py | Peter380/Python | 03b6cfda249cd538711d6a047a2e852dc91f84c5 | [
"MIT"
] | null | null | null | Blackjack/functions.py | Peter380/Python | 03b6cfda249cd538711d6a047a2e852dc91f84c5 | [
"MIT"
] | null | null | null | Blackjack/functions.py | Peter380/Python | 03b6cfda249cd538711d6a047a2e852dc91f84c5 | [
"MIT"
] | null | null | null |
#Functions for Blackjack
| 22.666667 | 82 | 0.596639 | import os
#Functions for Blackjack
def display_players_cards(Player):
for card in Player.hand:
print(card)
def get_players_bet():
valid_input = False
while valid_input == False:
try:
bet = int(input("How much are you betting? Please insert a number: "))
vali... | 0 | 0 | 0 | 0 | 0 | 360 | 0 | -12 | 98 |
22c5a1b7e06dc39bf91f470930269579fc50fe4b | 9,524 | py | Python | ait/dsn/cfdp/machines/machine.py | kmarwah/AIT-DSN | 338614dfef6713431f79d6daaffc0e4303be0ced | [
"MIT"
] | 12 | 2019-01-30T17:43:51.000Z | 2022-02-23T03:36:57.000Z | ait/dsn/cfdp/machines/machine.py | kmarwah/AIT-DSN | 338614dfef6713431f79d6daaffc0e4303be0ced | [
"MIT"
] | 117 | 2018-04-16T16:11:48.000Z | 2022-03-31T18:21:24.000Z | ait/dsn/cfdp/machines/machine.py | kmarwah/AIT-DSN | 338614dfef6713431f79d6daaffc0e4303be0ced | [
"MIT"
] | 12 | 2018-08-30T15:52:56.000Z | 2022-01-12T19:52:04.000Z | # Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
# Copyright 2018, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged. Any
# commercial use must be negotiated with the... | 36.212928 | 114 | 0.653507 | # Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
# Copyright 2018, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged. Any
# commercial use must be negotiated with the... | 0 | 384 | 0 | 8,127 | 0 | 0 | 0 | 104 | 137 |
6702ad0203698101aea2205d1430ecdc7231ca29 | 1,011 | py | Python | TestPython/win32_test.py | ppcrong/TestPython | 6a87d09e31ad662ce1dea707118d1e914dfeaba7 | [
"Apache-2.0"
] | null | null | null | TestPython/win32_test.py | ppcrong/TestPython | 6a87d09e31ad662ce1dea707118d1e914dfeaba7 | [
"Apache-2.0"
] | null | null | null | TestPython/win32_test.py | ppcrong/TestPython | 6a87d09e31ad662ce1dea707118d1e914dfeaba7 | [
"Apache-2.0"
] | null | null | null | """
ref: https://blog.csdn.net/chengqiuming/article/details/78601000
"""
import win32gui
wc = win32gui.WNDCLASS()
wc.hbrBackground = COLOR_BTNFACE + 1
wc.hCursor = win32gui.LoadCursor(0, IDI_APPLICATION)
wc.lpszClassName = "Python no Windows"
wc.lpfnWndProc = WndProc
reg = win32gui.RegisterClass(wc)
hwnd = win32gui.... | 33.7 | 109 | 0.714144 | """
ref: https://blog.csdn.net/chengqiuming/article/details/78601000
"""
import win32gui
from win32con import *
def WndProc(hwnd, msg, wParam, lParam):
if msg == WM_PAINT:
hdc, ps = win32gui.BeginPaint(hwnd)
rect = win32gui.GetClientRect(hwnd)
win32gui.DrawText(hdc, 'GUI Python', len('GUI ... | 0 | 0 | 0 | 0 | 0 | 399 | 0 | 1 | 45 |
4033af3baa2cce496ab17f96798632a32ab16573 | 1,842 | py | Python | resources/code/train/Python/unix_completers.py | searene/PLDetector | a8052b1d2ba91bfcc3fd4a5252480cf511d8a210 | [
"MIT"
] | 1 | 2020-11-09T08:24:17.000Z | 2020-11-09T08:24:17.000Z | resources/code/train/Python/unix_completers.py | searene/PLDetector | a8052b1d2ba91bfcc3fd4a5252480cf511d8a210 | [
"MIT"
] | null | null | null | resources/code/train/Python/unix_completers.py | searene/PLDetector | a8052b1d2ba91bfcc3fd4a5252480cf511d8a210 | [
"MIT"
] | null | null | null | # This file is part of the Hotwire Shell project API.
# Copyright (C) 2007 Colin Walters <walters@verbum.org>
# 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, includin... | 43.857143 | 86 | 0.741585 | # This file is part of the Hotwire Shell project API.
# Copyright (C) 2007 Colin Walters <walters@verbum.org>
# 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, includin... | 0 | 0 | 0 | 293 | 0 | 108 | 0 | 92 | 136 |
7b4db5c13a68afc8004647b967a4e4ecd74c7f3b | 1,688 | py | Python | securityheaders/checkers/csp/test_deprecateddirective.py | th3cyb3rc0p/securityheaders | 941264be581dc01afe28f6416f2d7bed79aecfb3 | [
"Apache-2.0"
] | 151 | 2018-07-29T22:34:43.000Z | 2022-03-22T05:08:27.000Z | securityheaders/checkers/csp/test_deprecateddirective.py | th3cyb3rc0p/securityheaders | 941264be581dc01afe28f6416f2d7bed79aecfb3 | [
"Apache-2.0"
] | 5 | 2019-04-24T07:31:36.000Z | 2021-04-15T14:31:23.000Z | securityheaders/checkers/csp/test_deprecateddirective.py | th3cyb3rc0p/securityheaders | 941264be581dc01afe28f6416f2d7bed79aecfb3 | [
"Apache-2.0"
] | 42 | 2018-07-31T08:18:59.000Z | 2022-03-28T08:18:32.000Z | import unittest
if __name__ == '__main__':
unittest.main()
| 33.098039 | 116 | 0.659953 | import unittest
from securityheaders.checkers.csp import CSPDeprecatedDirectiveChecker, CSPReportOnlyDeprecatedDirectiveChecker
class DeprectedDirectiveTest(unittest.TestCase):
def setUp(self):
self.x = CSPDeprecatedDirectiveChecker()
self.y = CSPReportOnlyDeprecatedDirectiveChecker()
def te... | 0 | 0 | 0 | 1,488 | 0 | 0 | 0 | 90 | 46 |
ff4152be70b620fb20dbfd2a00e10d70abf195e2 | 2,133 | py | Python | hooks/post_gen_project.py | insspb/python3-boilerplate | 7d70cd8a7bbbe2805ae5f4cb538996a30b96c736 | [
"MIT"
] | 3 | 2020-04-22T04:09:18.000Z | 2021-12-20T08:44:44.000Z | hooks/post_gen_project.py | insspb/python3-boilerplate | 7d70cd8a7bbbe2805ae5f4cb538996a30b96c736 | [
"MIT"
] | 11 | 2019-08-31T08:37:40.000Z | 2019-08-31T11:25:29.000Z | hooks/post_gen_project.py | insspb/python3-boilerplate | 7d70cd8a7bbbe2805ae5f4cb538996a30b96c736 | [
"MIT"
] | 1 | 2020-11-24T11:18:50.000Z | 2020-11-24T11:18:50.000Z | #!/usr/bin/env python
import os
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
if __name__ == '__main__':
if '{{ cookiecutter.authors_format }}' == 'Markdown':
remove_file('AUTHORS.rst')
remove_file('docs/source/AUTHORS.rst')
elif '{{ cookiecutter.authors_format }}' == 'reStructuredT... | 33.857143 | 94 | 0.65354 | #!/usr/bin/env python
import os
import shutil
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir)
def remove_file(filepath):
os.remove(os.path.join(PROJECT_DIRECTORY, filepath))
def remove_directory(dirpath):
shutil.rmtree(os.path.join(PROJECT_DIRECTORY, dirpath), ignore_errors=False, onerror=None)
if _... | 0 | 0 | 0 | 0 | 0 | 166 | 0 | -8 | 68 |
f86e8dde87c41ff53dc076cdae82faecd78c22b6 | 2,452 | py | Python | custom_components/magicmirror/coordinator.py | sindrebroch/ha-magicmirror-remote | 479d326065d834c695114359bb70b7627c14bf87 | [
"Apache-2.0"
] | 4 | 2021-10-31T00:43:38.000Z | 2022-02-27T19:54:12.000Z | custom_components/magicmirror/coordinator.py | sindrebroch/ha-magicmirror-remote | 479d326065d834c695114359bb70b7627c14bf87 | [
"Apache-2.0"
] | 5 | 2022-02-13T17:50:16.000Z | 2022-03-30T20:55:45.000Z | custom_components/magicmirror/coordinator.py | sindrebroch/ha-magicmirror | 479d326065d834c695114359bb70b7627c14bf87 | [
"Apache-2.0"
] | null | null | null | """The MagicMirror integration."""
from __future__ import annotations
| 34.535211 | 88 | 0.641109 | """The MagicMirror integration."""
from __future__ import annotations
from datetime import timedelta
from aiohttp.client_exceptions import ClientConnectorError
from async_timeout import timeout
from voluptuous.error import Error
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import D... | 0 | 0 | 1,126 | 729 | 0 | 0 | 0 | 278 | 248 |
d788a229f5971b43b029ba0f7cd215f7e844b9c5 | 4,328 | py | Python | hug/documentation.py | alisaifee/hug | bfd9b56fb5ce2a8c994219fa5941c28bc7f37bab | [
"MIT"
] | null | null | null | hug/documentation.py | alisaifee/hug | bfd9b56fb5ce2a8c994219fa5941c28bc7f37bab | [
"MIT"
] | null | null | null | hug/documentation.py | alisaifee/hug | bfd9b56fb5ce2a8c994219fa5941c28bc7f37bab | [
"MIT"
] | null | null | null | """hug/documentation.py
Defines tools that automate the creation of documentation for an API build using the Hug Framework
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to d... | 50.325581 | 117 | 0.597043 | """hug/documentation.py
Defines tools that automate the creation of documentation for an API build using the Hug Framework
Copyright (C) 2015 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to d... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
c0a073a2a76e8d22abebee5090e5a9a433d0dde2 | 257 | py | Python | src/tests/common_test.py | bronger/bobcat | 93e1cc88069001268824bc832490fd8db178848c | [
"MIT"
] | null | null | null | src/tests/common_test.py | bronger/bobcat | 93e1cc88069001268824bc832490fd8db178848c | [
"MIT"
] | null | null | null | src/tests/common_test.py | bronger/bobcat | 93e1cc88069001268824bc832490fd8db178848c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os.path
testmodules_path = os.path.dirname(os.path.abspath(__file__))
rootpath = os.path.split(testmodules_path)[0]
sys.path.append(rootpath)
| 23.363636 | 61 | 0.735409 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os.path
testmodules_path = os.path.dirname(os.path.abspath(__file__))
rootpath = os.path.split(testmodules_path)[0]
sys.path.append(rootpath)
def chdir_to_testbed():
os.chdir(testmodules_path)
| 0 | 0 | 0 | 0 | 0 | 33 | 0 | 0 | 23 |
a5e4382e2fe1aea2bd047a8db71a62a40e246774 | 476 | py | Python | kattis/k_apaxiaaans.py | ivanlyon/exercises | 0792976ae2acb85187b26a52812f9ebdd119b5e8 | [
"MIT"
] | null | null | null | kattis/k_apaxiaaans.py | ivanlyon/exercises | 0792976ae2acb85187b26a52812f9ebdd119b5e8 | [
"MIT"
] | null | null | null | kattis/k_apaxiaaans.py | ivanlyon/exercises | 0792976ae2acb85187b26a52812f9ebdd119b5e8 | [
"MIT"
] | null | null | null | '''
No problem, just process
Status: Accepted
'''
###############################################################################
def main():
"""Read input and print output"""
result = ''
for i in input():
if result:
if i != result[-1]:
result += i
else:
... | 19.04 | 79 | 0.315126 | '''
No problem, just process
Status: Accepted
'''
###############################################################################
def main():
"""Read input and print output"""
result = ''
for i in input():
if result:
if i != result[-1]:
result += i
else:
... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
8310fa13339108f5a042b8ebfc3966a35442df24 | 6,667 | py | Python | kolibri/plugins/coach/api.py | bonidjukic/kolibri | bbc6266b02da0cba7cb94c6eeb1b66d5e31d47f5 | [
"MIT"
] | null | null | null | kolibri/plugins/coach/api.py | bonidjukic/kolibri | bbc6266b02da0cba7cb94c6eeb1b66d5e31d47f5 | [
"MIT"
] | 3 | 2016-05-24T21:12:01.000Z | 2017-03-09T22:43:08.000Z | kolibri/plugins/coach/api.py | DXCanas/kolibri | 4571fc5e5482a2dc9cd8f93dd45222a69d8a68b4 | [
"MIT"
] | null | null | null | from kolibri.core.auth.constants import collection_kinds
collection_kind_choices = tuple([choice[0] for choice in collection_kinds.choices] + ['user'])
| 45.664384 | 122 | 0.744563 | import datetime
from dateutil.parser import parse
from django.db import connection
from django.db.models import Min
from django.db.models import Q
from django.utils import timezone
from rest_framework import mixins
from rest_framework import pagination
from rest_framework import permissions
from rest_framework import ... | 0 | 644 | 0 | 4,689 | 0 | 0 | 0 | 480 | 692 |
0694d04650787688fa74a9c2b1229237ea3faa9f | 2,412 | py | Python | src/student_code.py | azarrias/udacity-nd256-project4 | 295db734b854b477095cf8441498f72ade1ae03c | [
"MIT"
] | null | null | null | src/student_code.py | azarrias/udacity-nd256-project4 | 295db734b854b477095cf8441498f72ade1ae03c | [
"MIT"
] | null | null | null | src/student_code.py | azarrias/udacity-nd256-project4 | 295db734b854b477095cf8441498f72ade1ae03c | [
"MIT"
] | null | null | null |
# implement A* seaarch algorithm
# use euclidean distance to the goal node to determine the h value
# use stack to retrieve elements in reverse order | 37.107692 | 113 | 0.639718 | from math import sqrt
from collections import deque
class Node:
def __init__(self, _id):
self.id = _id
self.parent = None
self.g_value = 0
self.h_value = 0
# sort using g + h costs
def __lt__(self, other):
return self.g_value + self.h_value < other.g_value + other.h... | 0 | 0 | 0 | 317 | 0 | 1,802 | 0 | 8 | 133 |
51d9098bcedee877280944be77e98d7906ec131c | 6,436 | py | Python | venv/lib/python3.5/site-packages/praw/models/reddit/comment.py | cssidy/python-reddit | b9ec30662032993bb55c93aee5e2321fdbd5bf0c | [
"MIT"
] | null | null | null | venv/lib/python3.5/site-packages/praw/models/reddit/comment.py | cssidy/python-reddit | b9ec30662032993bb55c93aee5e2321fdbd5bf0c | [
"MIT"
] | null | null | null | venv/lib/python3.5/site-packages/praw/models/reddit/comment.py | cssidy/python-reddit | b9ec30662032993bb55c93aee5e2321fdbd5bf0c | [
"MIT"
] | null | null | null | """Provide the Comment class."""
| 37.202312 | 79 | 0.629117 | """Provide the Comment class."""
from ...const import urljoin
from ...exceptions import ClientException
from ..comment_forest import CommentForest
from .base import RedditBase
from .mixins import InboxableMixin, ThingModerationMixin, UserContentMixin
from .redditor import Redditor
class Comment(RedditBase, InboxableM... | 0 | 1,206 | 0 | 4,900 | 0 | 0 | 0 | 117 | 178 |
4745880a71149ff8c4b63d9e2ab860d088aa92ed | 1,290 | py | Python | venv/Lib/site-packages/networkutil/validation.py | avim2809/CameraSiteBlocker | bfc0434e75e8f3f95c459a4adc86b7673200816e | [
"Apache-2.0"
] | null | null | null | venv/Lib/site-packages/networkutil/validation.py | avim2809/CameraSiteBlocker | bfc0434e75e8f3f95c459a4adc86b7673200816e | [
"Apache-2.0"
] | null | null | null | venv/Lib/site-packages/networkutil/validation.py | avim2809/CameraSiteBlocker | bfc0434e75e8f3f95c459a4adc86b7673200816e | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Description: validation functions
| 23.454545 | 73 | 0.53876 | # -*- coding: utf-8 -*-
# Description: validation functions
from ipaddress import (AddressValueError, NetmaskValueError,
ip_address, IPv4Address, IPv6Address,
ip_network, IPv4Network, IPv6Network)
def valid_ip(ip,
method=ip_address):
try:
method... | 0 | 0 | 0 | 0 | 0 | 902 | 0 | 161 | 161 |
63728377d479403422a92ef81174df58b96731e3 | 433 | py | Python | nekumo/api/__init__.py | Nekmo/nekumo | 4e0b63de0794a23dbe43eebd88124edd11045cb0 | [
"MIT"
] | null | null | null | nekumo/api/__init__.py | Nekmo/nekumo | 4e0b63de0794a23dbe43eebd88124edd11045cb0 | [
"MIT"
] | 1 | 2016-03-31T17:57:15.000Z | 2016-03-31T17:57:15.000Z | nekumo/api/__init__.py | Nekmo/nekumo | 4e0b63de0794a23dbe43eebd88124edd11045cb0 | [
"MIT"
] | null | null | null | from nekumo.api.config import QuickStart
from nekumo.api.nodes import Dir, File, Node, Image, Video
__author__ = 'nekmo'
stanza_classes = [
# Este listado se recorre para determinar el tipo de clase mejor a usar
# con un nodo. Se usa un mtodo esttico is_capable para determinarlo.
# Por ejemplo, tendremos... | 25.470588 | 75 | 0.704388 | from nekumo.api.config import QuickStart
from nekumo.api.nodes import Dir, File, Node, Image, Video
__author__ = 'nekmo'
stanza_classes = [
# Este listado se recorre para determinar el tipo de clase mejor a usar
# con un nodo. Se usa un método estático is_capable para determinarlo.
# Por ejemplo, tendrem... | 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
cec52e737fbc12c84d80316828bc07b3c2d217d2 | 354 | py | Python | timer.py | edif/Countdown-timer | 625d62f3dabec93b52c5a9f7012177289fd9f067 | [
"MIT"
] | null | null | null | timer.py | edif/Countdown-timer | 625d62f3dabec93b52c5a9f7012177289fd9f067 | [
"MIT"
] | null | null | null | timer.py | edif/Countdown-timer | 625d62f3dabec93b52c5a9f7012177289fd9f067 | [
"MIT"
] | 1 | 2021-05-20T04:25:42.000Z | 2021-05-20T04:25:42.000Z | import time
import pygame
pygame.mixer.init()
alarm = pygame.mixer.Sound("alarm_ding.ogg")
alarm_len = alarm.get_length()
minutes = int(input ("Minutes:"))*60
seconds = int(input("Seconds:"))
timer = minutes + seconds
for i in range(timer):
print("", str(timer - i), end="\r")
time.sleep(1)
alarm.play()
print("t... | 25.285714 | 44 | 0.69209 | import time
import pygame
pygame.mixer.init()
alarm = pygame.mixer.Sound("alarm_ding.ogg")
alarm_len = alarm.get_length()
minutes = int(input ("Minutes:"))*60
seconds = int(input("Seconds:"))
timer = minutes + seconds
for i in range(timer):
print("", str(timer - i), end="\r")
time.sleep(1)
alarm.play()
print("t... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
be7462abf626e2b079537e2f1c3b0b33acf2580d | 2,886 | py | Python | Old PyGame stuff/snake/snake.py | Narcolapser/PyGameLearningByDoing | 460da31b190b2f4d44bb2914215efc04e3fc1c8f | [
"Apache-2.0"
] | null | null | null | Old PyGame stuff/snake/snake.py | Narcolapser/PyGameLearningByDoing | 460da31b190b2f4d44bb2914215efc04e3fc1c8f | [
"Apache-2.0"
] | null | null | null | Old PyGame stuff/snake/snake.py | Narcolapser/PyGameLearningByDoing | 460da31b190b2f4d44bb2914215efc04e3fc1c8f | [
"Apache-2.0"
] | null | null | null | #################################3##################################################################
# Name: Pygame Snake Experiement
# Purpose: Make a simple pygame game to get a handle on PyGame
# Date: 2013/12/22
# Programmer: Toben "Littlefoo" "Narcolapser" Archer
# Version: 0.1
##################################... | 23.088 | 100 | 0.618503 | #################################3##################################################################
# Name: Pygame Snake Experiement
# Purpose: Make a simple pygame game to get a handle on PyGame
# Date: 2013/12/22
# Programmer: Toben "Littlefoo" "Narcolapser" Archer
# Version: 0.1
##################################... | 0 | 0 | 0 | 0 | 0 | 1,101 | 0 | 6 | 183 |
0daa40e3ec7edb96b0896e8da663755d0a55eed0 | 7,692 | py | Python | examples/networking/decentralized-firewall/validator/validator.py | Kiranug/cloud-foundation-fabric | c4b2f85a3b197a6386081431d8e00d69f4b1ccfb | [
"Apache-2.0"
] | 84 | 2022-01-12T21:25:12.000Z | 2022-03-31T05:40:02.000Z | examples/networking/decentralized-firewall/validator/validator.py | Kiranug/cloud-foundation-fabric | c4b2f85a3b197a6386081431d8e00d69f4b1ccfb | [
"Apache-2.0"
] | 77 | 2022-01-12T18:49:05.000Z | 2022-03-29T13:05:17.000Z | examples/networking/decentralized-firewall/validator/validator.py | Kiranug/cloud-foundation-fabric | c4b2f85a3b197a6386081431d8e00d69f4b1ccfb | [
"Apache-2.0"
] | 55 | 2022-01-15T13:47:30.000Z | 2022-03-31T17:35:48.000Z | #!/usr/bin/env python3
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 29.247148 | 77 | 0.656526 | #!/usr/bin/env python3
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | 0 | 1,636 | 0 | 5,061 | 0 | 0 | 0 | -8 | 361 |
01cf7eb68c103c544c2212f518a5b1cea3c6bd46 | 10,355 | py | Python | Livid_Alias8/Alias.py | thomasf/LiveRemoteScripts | 866330653e1561a140e076c9a7ae64dd486e5692 | [
"MIT"
] | 25 | 2015-02-02T21:41:51.000Z | 2022-02-19T13:08:53.000Z | Livid_Alias8/Alias.py | thomasf/LiveRemoteScripts | 866330653e1561a140e076c9a7ae64dd486e5692 | [
"MIT"
] | null | null | null | Livid_Alias8/Alias.py | thomasf/LiveRemoteScripts | 866330653e1561a140e076c9a7ae64dd486e5692 | [
"MIT"
] | 13 | 2015-10-25T04:44:09.000Z | 2020-03-01T18:02:27.000Z | # amounra 0513 : http://www.aumhaa.com
from __future__ import with_statement
import Live
import math
""" _Framework files """
from _Framework.ButtonElement import ButtonElement # Class representing a button a the controller
from _Framework.ButtonMatrixElement import ButtonMatrixElement # Class representing a 2-dimen... | 39.67433 | 182 | 0.764558 | # amounra 0513 : http://www.aumhaa.com
from __future__ import with_statement
import Live
import math
""" _Framework files """
from _Framework.ButtonElement import ButtonElement # Class representing a button a the controller
from _Framework.ButtonMatrixElement import ButtonMatrixElement # Class representing a 2-dimen... | 0 | 0 | 0 | 6,771 | 0 | 0 | 0 | 33 | 187 |
26c6d3dc79c51eac0baadcc61f39d7c3b322a898 | 2,079 | py | Python | _posts/images/doConvert.py | mianli/mianli.GitHub.io | 6ab193670fb714e2817c64609f8d9e34d3628ca0 | [
"Apache-2.0"
] | null | null | null | _posts/images/doConvert.py | mianli/mianli.GitHub.io | 6ab193670fb714e2817c64609f8d9e34d3628ca0 | [
"Apache-2.0"
] | null | null | null | _posts/images/doConvert.py | mianli/mianli.GitHub.io | 6ab193670fb714e2817c64609f8d9e34d3628ca0 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#-*- coding: UTF-8 -*-
import os
import sys
os.chdir(sys.path[0])
print(os.getcwd())
cacheFolder = os.getcwd() + "/temp/"
cacheFile = cacheFolder + "temp"
caches = []
generalSize = "640X640"
if(len(sys.argv) > 1) :
wishSize = 640 * int(sys.argv[1])
generalSize = "%dx%d" % (wishSize, wis... | 25.9875 | 112 | 0.593074 | #!/usr/bin/env python
#-*- coding: UTF-8 -*-
import os
import time
import subprocess
import shutil
import sys
os.chdir(sys.path[0])
print(os.getcwd())
cacheFolder = os.getcwd() + "/temp/"
cacheFile = cacheFolder + "temp"
caches = []
generalSize = "640X640"
if(len(sys.argv) > 1) :
wishSize = 640 * int(sys.argv[1]... | 69 | 0 | 0 | 0 | 0 | 1,476 | 0 | -22 | 204 |
ad9b07576281a042d8aad9bfcdd0adced10ac6e5 | 5,537 | py | Python | Back-End/Python/External Libraries/Flask/Flask-Extensions/Flask-Admin/examples_01/flask_admin_/form/fields.py | ASHISHKUMAR2411/Programming-CookBook | 9c60655d64d21985ccb4196360858d98344701f9 | [
"MIT"
] | 25 | 2021-04-28T02:51:26.000Z | 2022-03-24T13:58:04.000Z | Back-End/Python/External Libraries/Flask/Flask-Extensions/Flask-Admin/examples_01/flask_admin_/form/fields.py | ASHISHKUMAR2411/Programming-CookBook | 9c60655d64d21985ccb4196360858d98344701f9 | [
"MIT"
] | 1 | 2022-03-03T23:33:41.000Z | 2022-03-03T23:35:41.000Z | Back-End/Python/External Libraries/Flask/Flask-Extensions/Flask-Admin/examples_01/flask_admin_/form/fields.py | ASHISHKUMAR2411/Programming-CookBook | 9c60655d64d21985ccb4196360858d98344701f9 | [
"MIT"
] | 15 | 2021-05-30T01:35:20.000Z | 2022-03-25T12:38:25.000Z | # Note taken from --> https://gist.github.com/JungeAlexander/6ce0a5213f3af56d7369 & https://stackoverflow.com/questions/714063/importing-modules-from-parent-folder/11158224#11158224
import os, sys, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirn... | 35.267516 | 182 | 0.579917 | # Note taken from --> https://gist.github.com/JungeAlexander/6ce0a5213f3af56d7369 & https://stackoverflow.com/questions/714063/importing-modules-from-parent-folder/11158224#11158224
import os, sys, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirn... | 0 | 0 | 0 | 4,747 | 0 | 0 | 0 | 14 | 250 |
7d855948e033681544c624f9db202049a09935ef | 4,275 | py | Python | tests/test_chi_ssa_23.py | MAYANK25402/city-scrapers | 08f92ec5b68682a8120eee1a13c4a03fe0335b9e | [
"MIT"
] | 255 | 2018-03-06T20:12:03.000Z | 2022-03-05T03:06:45.000Z | tests/test_chi_ssa_23.py | MAYANK25402/city-scrapers | 08f92ec5b68682a8120eee1a13c4a03fe0335b9e | [
"MIT"
] | 514 | 2018-02-02T16:12:50.000Z | 2022-03-21T20:07:35.000Z | tests/test_chi_ssa_23.py | MAYANK25402/city-scrapers | 08f92ec5b68682a8120eee1a13c4a03fe0335b9e | [
"MIT"
] | 342 | 2018-02-03T04:05:37.000Z | 2022-03-18T16:34:58.000Z | from os.path import dirname, join
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from scrapy.settings import Settings
from city_scrapers.spiders.chi_ssa_23 import ChiSsa23Spider
test_response = file_response(
join(dirname(__file__), "files", "chi_ssa_23.html"),
url="https... | 27.941176 | 78 | 0.633684 | from datetime import datetime
from os.path import dirname, join
import pytest
from city_scrapers_core.constants import COMMISSION, PASSED, TENTATIVE
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from scrapy.settings import Settings
from city_scrapers.spiders.chi_ssa_23 import Ch... | 0 | 887 | 0 | 0 | 0 | 2,307 | 0 | 49 | 343 |
aa6af1b7ac40407373d7abd8d55f9fb09c26ff8a | 604 | py | Python | test/tail.py | ubirch/visitor-counter | 97168d7252376358477c52bd956626596119526d | [
"Apache-2.0"
] | null | null | null | test/tail.py | ubirch/visitor-counter | 97168d7252376358477c52bd956626596119526d | [
"Apache-2.0"
] | null | null | null | test/tail.py | ubirch/visitor-counter | 97168d7252376358477c52bd956626596119526d | [
"Apache-2.0"
] | null | null | null |
filename = "../data/crackdump-01.csv"
read()
| 20.827586 | 43 | 0.541391 |
import subprocess
filename = "../data/crackdump-01.csv"
def filterLine(line):
filteredLine = ""
for c in line:
if(c >= ' ' and c <= '~'):
filteredLine = filteredLine + c
return filteredLine
def readlines():
with open(filename, 'r') as reader:
for line in reader.readlines(... | 0 | 0 | 0 | 0 | 0 | 469 | 0 | -4 | 92 |
ced0bd786362d194b6e5055700dffd67c232fe8c | 11,263 | py | Python | src/scep/Client/message.py | bikram990/PyScep | bf5ddae43a461c9aecf7f9fce357ba2ad6df19d7 | [
"MIT"
] | 3 | 2021-06-24T11:19:17.000Z | 2021-12-15T02:23:27.000Z | src/scep/Client/message.py | bikram990/PyScep | bf5ddae43a461c9aecf7f9fce357ba2ad6df19d7 | [
"MIT"
] | 1 | 2022-01-03T14:36:52.000Z | 2022-01-09T02:50:03.000Z | src/scep/Client/message.py | bikram990/PyScep | bf5ddae43a461c9aecf7f9fce357ba2ad6df19d7 | [
"MIT"
] | 1 | 2021-06-08T15:46:31.000Z | 2021-06-08T15:46:31.000Z | import logging
from asn1crypto.cms import CMSAttribute
from .asn1 import SCEPCMSAttributeType
CMSAttribute._fields = [
('type', SCEPCMSAttributeType),
('values', None),
]
logger = logging.getLogger(__name__)
| 42.026119 | 176 | 0.61671 | import logging
from base64 import b64encode
from asn1crypto.cms import CMSAttribute, ContentInfo, IssuerAndSerialNumber
from cryptography.hazmat.primitives.asymmetric import padding
from .asn1 import SCEPCMSAttributeType
from .cryptoutils import digest_for_data, decrypt, digest_function_for_type
from .enums import M... | 0 | 6,580 | 0 | 4,108 | 0 | 23 | 0 | 172 | 158 |
0c7b6fdf670903eeac00b2bdebeaac77c27ff620 | 1,874 | py | Python | src/scs_host/sys/host_serial.py | south-coast-science/scs_host_cpc | 08b4a28c022936462b60823cca136ba6746eac57 | [
"MIT"
] | null | null | null | src/scs_host/sys/host_serial.py | south-coast-science/scs_host_cpc | 08b4a28c022936462b60823cca136ba6746eac57 | [
"MIT"
] | null | null | null | src/scs_host/sys/host_serial.py | south-coast-science/scs_host_cpc | 08b4a28c022936462b60823cca136ba6746eac57 | [
"MIT"
] | null | null | null | """
Created on 26 Dec 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/port
"""
# --------------------------------------------------------------------------------------------------------------------
| 27.15942 | 118 | 0.419424 | """
Created on 26 Dec 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/port
"""
import serial
import time
from scs_core.sys.serial import Serial
from scs_host.lock.lock import Lock
# ---------------------------------------... | 0 | 169 | 0 | 1,284 | 0 | 0 | 0 | 13 | 114 |
421d48f13d55918c30bd53643b1115a143584398 | 1,324 | py | Python | utils_nlp/eval/evaluate_summarization.py | Anita1017/nlp-recipes | d4358193184cc0c80df04142f6e9773c47d2b0a4 | [
"MIT"
] | 4,407 | 2019-10-29T21:35:19.000Z | 2022-03-31T13:56:37.000Z | utils_nlp/eval/evaluate_summarization.py | shubham9g17/nlp-recipes | a5cd2303187239799ae0b1597a7c16eb99a97108 | [
"MIT"
] | 134 | 2019-10-30T23:38:59.000Z | 2022-03-01T11:42:53.000Z | utils_nlp/eval/evaluate_summarization.py | shubham9g17/nlp-recipes | a5cd2303187239799ae0b1597a7c16eb99a97108 | [
"MIT"
] | 726 | 2019-10-31T15:21:52.000Z | 2022-03-31T10:18:22.000Z | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from random import random, seed
from bertsum.others.utils import test_rouge
def get_rouge(predictions, targets, temp_dir, random_seed=42):
"""
function to get the rouge metric for the prediction and the reference.
Args:
... | 32.292683 | 82 | 0.688822 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import os
from random import random, seed
from bertsum.others.utils import test_rouge
def get_rouge(predictions, targets, temp_dir, random_seed=42):
"""
function to get the rouge metric for the prediction and the reference.
Args:
... | 0 | 0 | 0 | 0 | 0 | 211 | 0 | 0 | 27 |
a8422046d80155739467dee424ad8228f58634f6 | 1,045 | py | Python | BS01-flask-bootstrap-table-demo/app/__init__.py | AngelLiang/Flask-Demos | cf0a74885b873cb2583b3870ccdf3508d3af602e | [
"MIT"
] | 3 | 2020-06-17T05:44:48.000Z | 2021-09-11T02:49:38.000Z | BS01-flask-bootstrap-table-demo/app/__init__.py | AngelLiang/Flask-Demos | cf0a74885b873cb2583b3870ccdf3508d3af602e | [
"MIT"
] | 3 | 2021-06-08T20:57:03.000Z | 2022-02-23T14:54:59.000Z | BS01-flask-bootstrap-table-demo/app/__init__.py | AngelLiang/Flask-Demos | cf0a74885b873cb2583b3870ccdf3508d3af602e | [
"MIT"
] | 6 | 2020-06-17T05:44:56.000Z | 2022-03-29T12:53:05.000Z | from flask import Flask
from .extensions import db
app = Flask(__name__)
db.init_app(app)
db.app = app
# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = '123456790'
# Create in-memory database
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://data.sqlite'
| 23.222222 | 64 | 0.578947 | from flask import Flask
from .extensions import db
from .models import Tree
app = Flask(__name__)
db.init_app(app)
db.app = app
# Create dummy secrey key so we can use sessions
app.config['SECRET_KEY'] = '123456790'
# Create in-memory database
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://data.sqlite'
from .v... | 0 | 36 | 0 | 0 | 0 | 619 | 0 | 2 | 99 |
32feddd1d879cfa016bcef15524fa0b4df1a3d41 | 406 | py | Python | eeyore/stats/cov.py | papamarkou/eeyore | 4cd9b5a619cd095035aa93f348d1c937629aa8a3 | [
"MIT"
] | 6 | 2020-04-22T18:56:46.000Z | 2021-09-09T15:57:48.000Z | eeyore/stats/cov.py | papamarkou/eeyore | 4cd9b5a619cd095035aa93f348d1c937629aa8a3 | [
"MIT"
] | 19 | 2019-11-14T21:22:21.000Z | 2020-10-31T16:18:36.000Z | eeyore/stats/cov.py | scidom/eeyore | 4cd9b5a619cd095035aa93f348d1c937629aa8a3 | [
"MIT"
] | null | null | null |
# https://discuss.pytorch.org/t/covariance-and-gradient-support/16217
| 25.375 | 69 | 0.583744 | import torch
# https://discuss.pytorch.org/t/covariance-and-gradient-support/16217
def cov(x, rowvar=False):
if x.dim() > 2:
raise ValueError('x has more than 2 dimensions')
if x.dim() < 2:
x = x.view(1, -1)
if not rowvar and x.size(0) != 1:
x = x.t()
x_ctr = x - torch.mean(x,... | 0 | 0 | 0 | 0 | 0 | 299 | 0 | -9 | 45 |
82faabdefdf53899c72da40e04e2176c3d052adf | 212 | py | Python | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/compileall/compileall_path.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/compileall/compileall_path.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/compileall/compileall_path.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | # Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
# end_pymotw_header
import compileall
import sys
sys.path[:] = ["examples", "notthere"]
print("sys.path =", sys.path)
compileall.compile_path()
| 16.307692 | 55 | 0.70283 | # Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
# end_pymotw_header
import compileall
import sys
sys.path[:] = ["examples", "notthere"]
print("sys.path =", sys.path)
compileall.compile_path()
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
4b6a26436e528da9c6f39cd1f33f242f904440ad | 1,424 | py | Python | main.py | DwaraknathT/Diffusion-Models | dea059cbd7745aad1c535c0ee06fb15db0e3dd59 | [
"MIT"
] | 2 | 2022-03-18T18:46:31.000Z | 2022-03-23T08:36:06.000Z | main.py | DwaraknathT/Diffusion-Models | dea059cbd7745aad1c535c0ee06fb15db0e3dd59 | [
"MIT"
] | null | null | null | main.py | DwaraknathT/Diffusion-Models | dea059cbd7745aad1c535c0ee06fb15db0e3dd59 | [
"MIT"
] | null | null | null | import argparse
from datasets import get_dataset
from diffusion.trainers import get_trainer
# The first arg parser parses out only the --config argument, this argument is used to
# load a yaml file containing key-values that override the defaults for the main parser below
config_parser = parser = argparse.ArgumentPars... | 30.297872 | 93 | 0.711376 | import yaml
import argparse
from datasets import get_dataset
from diffusion.trainers import get_trainer
# The first arg parser parses out only the --config argument, this argument is used to
# load a yaml file containing key-values that override the defaults for the main parser below
config_parser = parser = argparse.... | 0 | 0 | 0 | 0 | 0 | 599 | 0 | -10 | 45 |
ab981234bd684eb515c2af0b043fcf592ef55044 | 15,143 | py | Python | pysnmp/CIENA-CES-ACL-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 11 | 2021-02-02T16:27:16.000Z | 2021-08-31T06:22:49.000Z | pysnmp/CIENA-CES-ACL-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 75 | 2021-02-24T17:30:31.000Z | 2021-12-08T00:01:18.000Z | pysnmp/CIENA-CES-ACL-MIB.py | agustinhenze/mibs.snmplabs.com | 1fc5c07860542b89212f4c8ab807057d9a9206c7 | [
"Apache-2.0"
] | 10 | 2019-04-30T05:51:36.000Z | 2022-02-16T03:33:41.000Z | #
# PySNMP MIB module CIENA-CES-ACL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CIENA-CES-ACL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:31:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | 132.833333 | 2,830 | 0.783861 | #
# PySNMP MIB module CIENA-CES-ACL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CIENA-CES-ACL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:31:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
c903af9ef97633a516d28b47dfa7db93f03ab9a0 | 1,218 | py | Python | src/terial/classifier/opensurfaces/resize.py | keunhong/photoshape | 6e795512e059bc5a6bdac748fda961f66d51c6f6 | [
"PostgreSQL"
] | 81 | 2018-10-10T06:55:41.000Z | 2022-03-01T04:18:23.000Z | src/terial/classifier/opensurfaces/resize.py | keunhong/photoshape | 6e795512e059bc5a6bdac748fda961f66d51c6f6 | [
"PostgreSQL"
] | 17 | 2018-10-22T04:50:59.000Z | 2022-02-12T00:29:11.000Z | src/terial/classifier/opensurfaces/resize.py | keunhong/photoshape | 6e795512e059bc5a6bdac748fda961f66d51c6f6 | [
"PostgreSQL"
] | 16 | 2018-11-20T06:57:32.000Z | 2021-12-24T07:09:37.000Z | import argparse
from pathlib import Path
parser = argparse.ArgumentParser()
parser.add_argument(dest='base_dir', type=Path)
parser.add_argument(dest='out_dir', type=Path)
args = parser.parse_args()
if __name__ == '__main__':
main()
| 27.066667 | 64 | 0.65353 | import argparse
from functools import partial
from multiprocessing import Pool
from pathlib import Path
from PIL import Image
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument(dest='base_dir', type=Path)
parser.add_argument(dest='out_dir', type=Path)
args = parser.parse_args()
def resize_... | 0 | 0 | 0 | 0 | 0 | 822 | 0 | 19 | 135 |
7185ca21d2152e85a78bb4b577624ecfce010843 | 1,153 | py | Python | helpers/getPrice.py | v1s1t0r999/Novell | 4499e5c0634b12dfbd5b5e8ba671b579b7ac5be9 | [
"MIT"
] | 8 | 2021-08-13T03:00:34.000Z | 2021-08-22T05:08:03.000Z | helpers/getPrice.py | v1s1t0r999/Novell | 4499e5c0634b12dfbd5b5e8ba671b579b7ac5be9 | [
"MIT"
] | 9 | 2021-08-15T20:27:59.000Z | 2021-09-06T20:22:36.000Z | helpers/getPrice.py | v1s1t0r999/Novell | 4499e5c0634b12dfbd5b5e8ba671b579b7ac5be9 | [
"MIT"
] | 9 | 2021-08-14T16:43:04.000Z | 2021-09-07T19:14:33.000Z |
symbolNamePairs = {
"BITCOIN": "BTC",
"ETHEREUM": "ETH",
"DOGECOIN": "DOGE",
}
setting = settings()
| 25.622222 | 83 | 0.616652 | import requests
from helpers.logHelper import logger
symbolNamePairs = {
"BITCOIN": "BTC",
"ETHEREUM": "ETH",
"DOGECOIN": "DOGE",
}
class settings:
def __init__(self):
self.endpoint = "https://api.binance.com"
setting = settings()
def request(method, path, params=None):
... | 0 | 0 | 0 | 70 | 0 | 796 | 0 | 9 | 146 |
aff4de3fc4484ab22adaf2ed2a6838f63f81a8ff | 5,721 | py | Python | vmpy/streams.py | sladkovm/Velometria.py | 22c97723f3b5ba5342a6178535f48cc426daac2f | [
"MIT"
] | 2 | 2016-09-04T09:26:03.000Z | 2017-07-27T05:52:06.000Z | vmpy/streams.py | sladkovm/Velometria.py | 22c97723f3b5ba5342a6178535f48cc426daac2f | [
"MIT"
] | 4 | 2016-08-03T17:54:12.000Z | 2016-08-09T20:11:45.000Z | vmpy/streams.py | sladkovm/Velometria_py | 22c97723f3b5ba5342a6178535f48cc426daac2f | [
"MIT"
] | null | null | null | """Operation on Streams that leave the shape of the stream unchanged"""
import numpy as np
import pandas as pd
from vmpy.utils import cast_array_to_original_type
# FTP based 7-zones with left bind edge set to -0.001
POWER_ZONES_THRESHOLD = [-0.001, 0.55, 0.75, 0.9, 1.05, 1.2, 1.5, 10.0]
POWER_ZONES_THRESHOLD_DESC = ... | 28.044118 | 103 | 0.650586 | """Operation on Streams that leave the shape of the stream unchanged"""
import numpy as np
import pandas as pd
from vmpy.utils import cast_array_to_original_type
# FTP based 7-zones with left bind edge set to -0.001
POWER_ZONES_THRESHOLD = [-0.001, 0.55, 0.75, 0.9, 1.05, 1.2, 1.5, 10.0]
POWER_ZONES_THRESHOLD_DESC = ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
9ba8c51d46d3e3446c3291a3adefab5e9344eac3 | 1,577 | py | Python | arividam/djangocms_news/cms_plugins.py | c4sc/arividam | b728322d59ec48d6811ed7a709157a594e5653d4 | [
"MIT"
] | 3 | 2016-05-26T06:03:11.000Z | 2016-07-09T07:12:22.000Z | arividam/djangocms_news/cms_plugins.py | c4sc/arividam | b728322d59ec48d6811ed7a709157a594e5653d4 | [
"MIT"
] | 33 | 2016-05-26T05:33:00.000Z | 2017-12-06T12:08:17.000Z | arividam/djangocms_news/cms_plugins.py | c4sc/arividam | b728322d59ec48d6811ed7a709157a594e5653d4 | [
"MIT"
] | null | null | null | from cms.plugin_pool import plugin_pool
import logging
logger = logging.getLogger(__name__)
plugin_pool.register_plugin(NewsPlugin)
plugin_pool.register_plugin(FeaturedNewsPlugin)
| 32.183673 | 93 | 0.701966 | from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from cms.models import Page
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from arividam.ut... | 0 | 0 | 0 | 1,007 | 0 | 0 | 0 | 165 | 222 |
b4817a06e5f0a3ae68d8d96eca0ab9f4ed6b270c | 1,212 | py | Python | util/update.py | suchak1/hyperdrive | 8bc78af179de8d2b26968683d3248840f7470d4c | [
"MIT"
] | 20 | 2020-11-03T10:20:32.000Z | 2022-03-01T13:28:39.000Z | util/update.py | suchak1/hyperdrive | 8bc78af179de8d2b26968683d3248840f7470d4c | [
"MIT"
] | 70 | 2020-11-05T08:06:57.000Z | 2022-03-31T11:20:59.000Z | util/update.py | suchak1/hyperdrive | 8bc78af179de8d2b26968683d3248840f7470d4c | [
"MIT"
] | 5 | 2021-04-07T05:26:40.000Z | 2022-02-25T15:26:02.000Z | import os
import re
import requests
import subprocess
filename = 'requirements.txt'
new_packages = []
with open(filename, 'r') as file:
pattern = '(.*) == (.*)'
packages = re.findall(pattern, file.read())
for package, version in packages:
response = requests.get(f'https://pypi.org/pypi... | 33.666667 | 75 | 0.546205 | import os
import re
import requests
import subprocess
filename = 'requirements.txt'
new_packages = []
with open(filename, 'r') as file:
pattern = '(.*) == (.*)'
packages = re.findall(pattern, file.read())
for package, version in packages:
response = requests.get(f'https://pypi.org/pypi... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
b7ba00d67a5f1b17de35a1d6768295104c0874fb | 222 | py | Python | subarrrayDivision.py | sanjaykaswan/HackerRank | 23cebf02bfacea50d5982ce889b76025312c5c61 | [
"MIT"
] | null | null | null | subarrrayDivision.py | sanjaykaswan/HackerRank | 23cebf02bfacea50d5982ce889b76025312c5c61 | [
"MIT"
] | null | null | null | subarrrayDivision.py | sanjaykaswan/HackerRank | 23cebf02bfacea50d5982ce889b76025312c5c61 | [
"MIT"
] | 1 | 2020-10-05T11:55:48.000Z | 2020-10-05T11:55:48.000Z | n = int(input())
num = list(map(int , input().split()))
d,m = map(int , input().split())
c= 0
for i in range(0,n-m+1):
d_ = 0
for j in range(0,m):
d_ += num[i+j]
if d_ == d:
c += 1
print(c) | 14.8 | 38 | 0.463964 | n = int(input())
num = list(map(int , input().split()))
d,m = map(int , input().split())
c= 0
for i in range(0,n-m+1):
d_ = 0
for j in range(0,m):
d_ += num[i+j]
if d_ == d:
c += 1
print(c) | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
58a7e0d66eb0c7383e5fc0b4dcbd11f6f7eace49 | 4,222 | py | Python | tests/wrappers/test_multioutput.py | bpkwee/metrics | 3aba057ad9ff87183aaaf5988b8ccfdab81b2095 | [
"Apache-2.0"
] | null | null | null | tests/wrappers/test_multioutput.py | bpkwee/metrics | 3aba057ad9ff87183aaaf5988b8ccfdab81b2095 | [
"Apache-2.0"
] | null | null | null | tests/wrappers/test_multioutput.py | bpkwee/metrics | 3aba057ad9ff87183aaaf5988b8ccfdab81b2095 | [
"Apache-2.0"
] | null | null | null | from collections import namedtuple
import torch
from sklearn.metrics import accuracy_score
from sklearn.metrics import r2_score as sk_r2score
from tests.helpers import seed_all
from tests.helpers.testers import BATCH_SIZE, NUM_BATCHES, NUM_CLASSES
seed_all(42)
num_targets = 2
Input = namedtuple("Input", ["preds",... | 34.048387 | 114 | 0.681431 | from collections import namedtuple
from functools import partial
import pytest
import torch
from sklearn.metrics import accuracy_score
from sklearn.metrics import r2_score as sk_r2score
from tests.helpers import seed_all
from tests.helpers.testers import BATCH_SIZE, NUM_BATCHES, NUM_CLASSES, MetricTester
from torchme... | 0 | 1,625 | 0 | 890 | 0 | 0 | 0 | 116 | 179 |
691178639c6d8f94470bbd96184c210f322e6490 | 9,225 | py | Python | oldp/apps/references/models.py | ImgBotApp/oldp | 575dc6f711dde3470d910e21c9440ee9b79a69ed | [
"MIT"
] | 3 | 2020-06-27T08:19:35.000Z | 2020-12-27T17:46:02.000Z | oldp/apps/references/models.py | ImgBotApp/oldp | 575dc6f711dde3470d910e21c9440ee9b79a69ed | [
"MIT"
] | null | null | null | oldp/apps/references/models.py | ImgBotApp/oldp | 575dc6f711dde3470d910e21c9440ee9b79a69ed | [
"MIT"
] | null | null | null | import logging
logger = logging.getLogger(__name__)
# @receiver(pre_save, sender=Reference)
# def json_dumps_reference(sender, instance, *args, **kwargs):
# if not isinstance(instance.to, str):
# instance.to = json.dumps(instance.to)
# @receiver(post_init, sender=LawReference)
# def json_loads... | 30.04886 | 157 | 0.617344 | import hashlib
import json
import logging
import re
import uuid
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from oldp.apps.cases.models import Case
from oldp.apps.laws.models import Law
logger = logging.getLogger(__name__)
class ReferenceMarker(mo... | 6 | 982 | 0 | 7,250 | 0 | 0 | 0 | 41 | 430 |
1b56f073718e33f60f9ca4b06328c7693d89ada9 | 136 | py | Python | apt-flash.py | apt-flash/apt-flash | 9ea6ebf016988f51407005b7e3d234b4807612d4 | [
"MIT"
] | null | null | null | apt-flash.py | apt-flash/apt-flash | 9ea6ebf016988f51407005b7e3d234b4807612d4 | [
"MIT"
] | null | null | null | apt-flash.py | apt-flash/apt-flash | 9ea6ebf016988f51407005b7e3d234b4807612d4 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import os
if os.geteuid() != 0:
exit('This script requires root privileges.\nPlease try again with sudo.')
| 19.428571 | 78 | 0.698529 | #!/usr/bin/env python3
import os
if os.geteuid() != 0:
exit('This script requires root privileges.\nPlease try again with sudo.')
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
c71155e531dae239fa04c8b65a3d46aaeb1df3cc | 2,962 | py | Python | avg_embedding_means.py | lidalei/Real-Time-Voice-Cloning | 25d39c31b96d6c5b1783b36d9c09bb2a450ddaee | [
"MIT"
] | 1 | 2019-11-07T14:07:23.000Z | 2019-11-07T14:07:23.000Z | avg_embedding_means.py | lidalei/Real-Time-Voice-Cloning | 25d39c31b96d6c5b1783b36d9c09bb2a450ddaee | [
"MIT"
] | null | null | null | avg_embedding_means.py | lidalei/Real-Time-Voice-Cloning | 25d39c31b96d6c5b1783b36d9c09bb2a450ddaee | [
"MIT"
] | null | null | null | import argparse
from pathlib import Path
_NUM_ENROLLMENTS = 3
_NUM_VERIFICATIONS = 5
_WAV_FODLER = Path('/Users/dalei/Downloads/VCTK-Corpus/wav48')
_TXT_FODLER = Path('/Users/dalei/Downloads/VCTK-Corpus/txt')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
args, _ = parser.parse_known_args()
... | 38.973684 | 118 | 0.667792 | import argparse
from pathlib import Path
import typing
import numpy as np
import scipy.spatial.distance
from encoder.inference import Model as EncoderModel
from synthesizer.inference import Synthesizer
_NUM_ENROLLMENTS = 3
_NUM_VERIFICATIONS = 5
_WAV_FODLER = Path('/Users/dalei/Downloads/VCTK-Corpus/wav48')
_TXT_FO... | 0 | 0 | 0 | 0 | 0 | 2,440 | 0 | 51 | 136 |
6a36a28b6799120be05f798a21f49d9d39daf42b | 1,813 | py | Python | dist-packages/cupshelpers/__init__.py | Jianwei-Wang/python2.7_lib | 911b8e81512e5ac5f13e669ab46f7693ed897378 | [
"PSF-2.0"
] | null | null | null | dist-packages/cupshelpers/__init__.py | Jianwei-Wang/python2.7_lib | 911b8e81512e5ac5f13e669ab46f7693ed897378 | [
"PSF-2.0"
] | null | null | null | dist-packages/cupshelpers/__init__.py | Jianwei-Wang/python2.7_lib | 911b8e81512e5ac5f13e669ab46f7693ed897378 | [
"PSF-2.0"
] | null | null | null | ## system-config-printer
## Copyright (C) 2008, 2011 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Lice... | 29.721311 | 82 | 0.669608 | ## system-config-printer
## Copyright (C) 2008, 2011 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the Lice... | 0 | 0 | 0 | 0 | 0 | 30 | 0 | 112 | 45 |
6afe9bb9c57f5f20486a9a35bab9902e2d952b02 | 3,910 | py | Python | tests/analysis/test_is_linear.py | alinavalinav/finn | e443a5859066a410a63c08dcfec4a90527ca24be | [
"BSD-3-Clause"
] | 1 | 2021-01-29T14:39:48.000Z | 2021-01-29T14:39:48.000Z | tests/analysis/test_is_linear.py | alinavalinav/finn | e443a5859066a410a63c08dcfec4a90527ca24be | [
"BSD-3-Clause"
] | null | null | null | tests/analysis/test_is_linear.py | alinavalinav/finn | e443a5859066a410a63c08dcfec4a90527ca24be | [
"BSD-3-Clause"
] | 1 | 2022-03-07T02:57:55.000Z | 2022-03-07T02:57:55.000Z | # Copyright (c) 2020, Xilinx
# 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 follow... | 45.465116 | 80 | 0.693606 | # Copyright (c) 2020, Xilinx
# 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 follow... | 0 | 0 | 0 | 0 | 0 | 2,148 | 0 | 85 | 158 |
eb369cd06803c8f52ecb564772f3688e3b56e158 | 3,074 | py | Python | examples/data_feed/feeder.py | B3K7/mygeotab-python | ef0064543b6d859044e815c629a0f7998e479247 | [
"Apache-2.0"
] | 40 | 2015-08-20T16:13:52.000Z | 2022-01-07T13:30:27.000Z | examples/data_feed/feeder.py | B3K7/mygeotab-python | ef0064543b6d859044e815c629a0f7998e479247 | [
"Apache-2.0"
] | 227 | 2015-08-20T17:41:07.000Z | 2022-01-15T01:57:26.000Z | examples/data_feed/feeder.py | B3K7/mygeotab-python | ef0064543b6d859044e815c629a0f7998e479247 | [
"Apache-2.0"
] | 17 | 2016-05-12T16:06:32.000Z | 2022-01-10T19:03:40.000Z | # -*- coding: utf-8 -*-
if __name__ == "__main__":
main()
| 32.702128 | 99 | 0.599545 | # -*- coding: utf-8 -*-
from collections import defaultdict
import click
from mygeotab import API, dates
from mygeotab.ext import feed
class ExceptionDataFeedListener(feed.DataFeedListener):
def __init__(self, api):
"""
A simple Data Feed listener for Exception Event data
:param api: T... | 0 | 773 | 0 | 2,075 | 0 | 0 | 0 | 23 | 137 |
436776e2a237f4bbde5b9774d3036d52e8647ff0 | 13,211 | py | Python | offline/orchestrator.py | JoshBClemons/gesture_recognition | d1ddc6d086bf93b36a430fbcae0af14b9c584e92 | [
"MIT"
] | null | null | null | offline/orchestrator.py | JoshBClemons/gesture_recognition | d1ddc6d086bf93b36a430fbcae0af14b9c584e92 | [
"MIT"
] | null | null | null | offline/orchestrator.py | JoshBClemons/gesture_recognition | d1ddc6d086bf93b36a430fbcae0af14b9c584e92 | [
"MIT"
] | null | null | null | from config import Config
import psycopg2
from psycopg2.extras import Json, DictCursor
import pandas as pd
import os
import time
import cv2
from gesture_recognition import featurizer
def orchestrator():
"""Pull frames with confidence, accurate predictions from database and use them to generate new model."""
#... | 51.807843 | 233 | 0.660737 | from config import Config
import psycopg2
from psycopg2.extras import Json, DictCursor
import pdb
import pandas as pd
import os
import time
import cv2
from gesture_recognition import featurizer
def orchestrator():
"""Pull frames with confidence, accurate predictions from database and use them to generate new model... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | -11 | 22 |
007bbb746348f00e9c4355aa7932c325a9e58bb7 | 4,535 | py | Python | tasks/scan.py | KodaneFlash/hawk | de614df1fc50cc817be06e9902965dd2d65f9197 | [
"MIT"
] | null | null | null | tasks/scan.py | KodaneFlash/hawk | de614df1fc50cc817be06e9902965dd2d65f9197 | [
"MIT"
] | null | null | null | tasks/scan.py | KodaneFlash/hawk | de614df1fc50cc817be06e9902965dd2d65f9197 | [
"MIT"
] | null | null | null | import nmap
scanner = nmap.PortScanner()
| 43.605769 | 170 | 0.53914 | import nmap
import sys
import os
import multiprocessing
import socket
from colorama import Fore, Back, Style
scanner = nmap.PortScanner()
def scanStatus(host, inputed):
try:
scanner.scan(host, '1', '-v -sT')
except KeyboardInterrupt:
sys.exit('\n^C\n')
except Exception as e:
e =... | 0 | 0 | 0 | 0 | 0 | 4,267 | 0 | -13 | 226 |
3eb34fa6cb8beeae879580c7a63d82608bf47010 | 1,490 | py | Python | world/exploration/migrations/0043_auto_20181122_1409.py | tellg/arxcode | f04340f9466c31f59bc13b8e1afd4f5734da4848 | [
"MIT"
] | 5 | 2019-03-16T08:26:53.000Z | 2019-11-27T15:42:16.000Z | world/exploration/migrations/0043_auto_20181122_1409.py | tellg/arxcode | f04340f9466c31f59bc13b8e1afd4f5734da4848 | [
"MIT"
] | 7 | 2018-09-29T05:08:15.000Z | 2021-06-10T21:35:32.000Z | world/exploration/migrations/0043_auto_20181122_1409.py | tellg/arxcode | f04340f9466c31f59bc13b8e1afd4f5734da4848 | [
"MIT"
] | 7 | 2018-09-19T21:11:29.000Z | 2019-11-19T12:46:14.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-22 14:09
from __future__ import unicode_literals
| 40.27027 | 149 | 0.636242 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-22 14:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dominion', '0035_auto_20180831_0922'),
('explorati... | 0 | 0 | 0 | 1,277 | 0 | 0 | 0 | 30 | 68 |
dca5bd39d6d0f512d47fb32d7d9113e50f17f9eb | 3,977 | py | Python | tests/large/test_mode_replay.py | arjunkhunti-crest/eventgen | 3c551aa9fe53717797ff0bf9cf7d2f094b801bf2 | [
"Apache-2.0"
] | null | null | null | tests/large/test_mode_replay.py | arjunkhunti-crest/eventgen | 3c551aa9fe53717797ff0bf9cf7d2f094b801bf2 | [
"Apache-2.0"
] | null | null | null | tests/large/test_mode_replay.py | arjunkhunti-crest/eventgen | 3c551aa9fe53717797ff0bf9cf7d2f094b801bf2 | [
"Apache-2.0"
] | null | null | null | import re
import time
from datetime import datetime, timedelta
def test_mode_replay(eventgen_test_helper):
"""Test normal replay mode settings"""
events = eventgen_test_helper("eventgen_replay.conf").get_events()
# assert the event length is the same as sample file size
assert len(events) == 12
pa... | 42.308511 | 110 | 0.70606 | import re
import time
from datetime import datetime, timedelta
def test_mode_replay(eventgen_test_helper):
"""Test normal replay mode settings"""
events = eventgen_test_helper("eventgen_replay.conf").get_events()
# assert the event length is the same as sample file size
assert len(events) == 12
pa... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
5eeddddcee7e0edc3a2f862f662a93f9dbfdb494 | 516 | py | Python | build_pipeline/250_invalidate_cdn.py | undefinedvalue/statdev | 4e71961bd9f8e6ee49de4ddc539033ace47967a7 | [
"MIT"
] | null | null | null | build_pipeline/250_invalidate_cdn.py | undefinedvalue/statdev | 4e71961bd9f8e6ee49de4ddc539033ace47967a7 | [
"MIT"
] | null | null | null | build_pipeline/250_invalidate_cdn.py | undefinedvalue/statdev | 4e71961bd9f8e6ee49de4ddc539033ace47967a7 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Invalidates CDNs so the caches are refreshed
| 27.157895 | 78 | 0.536822 | #!/usr/bin/env python
# Invalidates CDNs so the caches are refreshed
import boto3
import os
import time
def build(src_dir, dst_dir, opts):
distribution_id = os.environ['CF_DIST_ID']
cf = boto3.client('cloudfront')
cf.create_invalidation(DistributionId=distribution_id,
Invalidat... | 0 | 0 | 0 | 0 | 0 | 386 | 0 | -31 | 90 |
478fa499138e17cac8e71a56b7291ffca49ce6ae | 4,089 | py | Python | powersimdata/tests/test_mocks.py | c-voegele/PowerSimData | 5b1500e573f00a34571316796ff442bfa753871a | [
"MIT"
] | 27 | 2021-02-20T20:55:31.000Z | 2022-02-07T17:27:14.000Z | powersimdata/tests/test_mocks.py | c-voegele/PowerSimData | 5b1500e573f00a34571316796ff442bfa753871a | [
"MIT"
] | 147 | 2021-01-21T03:55:09.000Z | 2022-03-28T19:28:03.000Z | powersimdata/tests/test_mocks.py | c-voegele/PowerSimData | 5b1500e573f00a34571316796ff442bfa753871a | [
"MIT"
] | 27 | 2021-02-03T18:24:47.000Z | 2022-01-26T08:56:17.000Z |
period_num = 4
# plant_id is the index
mock_plant = {
"plant_id": [101, 102, 103, 104, 105, 106],
"bus_id": [1001, 1002, 1003, 1004, 1005, 1006],
"type": ["solar", "wind", "ng", "coal", "dfo", "hydro"],
"zone_id": [1, 2, 3, 1, 3, 2],
"GenFuelCost": [0, 0, 3.3, 4.4, 5.5, 0],
"Pmin": [0, 0, 0, 0... | 33.243902 | 88 | 0.657863 | import pandas as pd
import pytest
from powersimdata.tests.mock_grid import MockGrid
from powersimdata.tests.mock_scenario import MockScenario
from powersimdata.tests.mock_scenario_info import MockScenarioInfo
period_num = 4
# plant_id is the index
mock_plant = {
"plant_id": [101, 102, 103, 104, 105, 106],
"b... | 0 | 825 | 0 | 2,516 | 0 | 0 | 0 | 99 | 272 |
98c1eb817cab95bc96bf3fec5e9194d3bc60bf96 | 2,575 | py | Python | Chap09/inheritance.py | RiddhiDamani/Python | 06cba66aeafd9dc0fa849ec2112c0786a3e8f001 | [
"MIT"
] | null | null | null | Chap09/inheritance.py | RiddhiDamani/Python | 06cba66aeafd9dc0fa849ec2112c0786a3e8f001 | [
"MIT"
] | null | null | null | Chap09/inheritance.py | RiddhiDamani/Python | 06cba66aeafd9dc0fa849ec2112c0786a3e8f001 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
# Class inheritance is the fundamental part of OOP
# allows you to extend your class by deriving properties/variables and methods from parent classes.
# using duck class to inherit base class animal.
# using kitten class to inherit base class animal.... | 30.654762 | 108 | 0.617087 | #!/usr/bin/env python3
# Copyright 2009-2017 BHG http://bw.org/
# Class inheritance is the fundamental part of OOP
# allows you to extend your class by deriving properties/variables and methods from parent classes.
class Animal:
# no longer providing default values.
# it is bcz this is going to be the base ... | 0 | 0 | 0 | 1,790 | 0 | 313 | 0 | 0 | 113 |
5eee50537386ae39b316d1fd68278deb85410400 | 550 | py | Python | mixer/helper/reader_helper.py | Jwuthri/GtfsTools | d0db0c89588f936f02d4e6cccb70034ec1e4b9b1 | [
"MIT"
] | 2 | 2017-10-30T07:27:02.000Z | 2021-11-09T18:50:13.000Z | mixer/helper/reader_helper.py | Jwuthri/GtfsTools | d0db0c89588f936f02d4e6cccb70034ec1e4b9b1 | [
"MIT"
] | 1 | 2017-02-24T20:50:10.000Z | 2017-02-24T22:40:33.000Z | mixer/helper/reader_helper.py | Jwuthri/GtfsTools | d0db0c89588f936f02d4e6cccb70034ec1e4b9b1 | [
"MIT"
] | null | null | null | """Here are the db connection."""
| 25 | 61 | 0.583636 | """Here are the db connection."""
import importlib
import logging
from mixer.settings import db_type
from mixer.glogger import logger
class Reader(object):
"""Helper to gen the reader class."""
def __init__(self, db_name):
"""Constructor."""
DB = getattr(
importlib.... | 0 | 0 | 0 | 382 | 0 | 0 | 0 | 12 | 119 |
3fe2fe671496f997af36a47fd5c43e2d207766db | 1,964 | py | Python | Logistic-Regression-Insurance-claim-prediction/code.py | ChandrakantKate/ga-learner-dsmp-repo | e6c53282bbd42c8055c18a2f1203ea76eafa102a | [
"MIT"
] | null | null | null | Logistic-Regression-Insurance-claim-prediction/code.py | ChandrakantKate/ga-learner-dsmp-repo | e6c53282bbd42c8055c18a2f1203ea76eafa102a | [
"MIT"
] | null | null | null | Logistic-Regression-Insurance-claim-prediction/code.py | ChandrakantKate/ga-learner-dsmp-repo | e6c53282bbd42c8055c18a2f1203ea76eafa102a | [
"MIT"
] | null | null | null | # --------------
# import the libraries
import pandas as pd
import seaborn as sns
from sklearn.model_selection import train_test_split
import warnings
warnings.filterwarnings('ignore')
# Code starts here
df = pd.read_csv(path)
print(df.head())
X = df.drop('insuranceclaim',axis=1)
y = df['insuranceclaim']
X_train,X_te... | 21.347826 | 82 | 0.709267 | # --------------
# import the libraries
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.model_selection import train_test_split
import warnings
warnings.filterwarnings('ignore')
# Code starts here
df = pd.read_csv(path)
print(df.head())
X = df.drop('insuranceclaim',axis=1)
y = df['insurancecl... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 22 |
1755f9e2f59a10f2dae8d950fcd4b40d9bc268b5 | 3,763 | py | Python | Recover Binary Search Tree.py | JazzikPeng/Algorithm-in-Python | 915135b1cdd02a6bb8d7068a54b2f497b2ec31d4 | [
"MIT"
] | 3 | 2018-02-05T06:15:57.000Z | 2019-04-07T23:33:07.000Z | Recover Binary Search Tree.py | JazzikPeng/Algorithm-in-Python | 915135b1cdd02a6bb8d7068a54b2f497b2ec31d4 | [
"MIT"
] | null | null | null | Recover Binary Search Tree.py | JazzikPeng/Algorithm-in-Python | 915135b1cdd02a6bb8d7068a54b2f497b2ec31d4 | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
# Do in order traversal. The in order traversal is monotonically increase
# O(1) Space, can not use iterative method or recursive solution, both use space
# class Solution(object):
# first = TreeNode(None)
# second = TreeNode(None)
# prev = TreeNode(None)
# def re... | 32.439655 | 80 | 0.459208 | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# Do in order traversal. The in order traversal is monotonically increase
# O(1) Space, can not use iterative method or recursive solution, both use space
# c... | 0 | 0 | 0 | 2,836 | 0 | 0 | 0 | 0 | 67 |
8f8abd51d28441a8163759ad81bbc9edd88b368d | 1,370 | py | Python | utils/CreateTemplate.py | ausaafnabi/ML-OverRPC-API | b2ddbfac3f4c4f5ae97e030be7e4a4dfcd4d6635 | [
"MIT"
] | 1 | 2020-06-23T17:02:09.000Z | 2020-06-23T17:02:09.000Z | utils/CreateTemplate.py | ausaafnabi/ML-OverRPC-API | b2ddbfac3f4c4f5ae97e030be7e4a4dfcd4d6635 | [
"MIT"
] | 7 | 2020-03-31T06:46:14.000Z | 2020-04-12T11:25:39.000Z | utils/CreateTemplate.py | ausaafnabi/ML-OverRPC-API | b2ddbfac3f4c4f5ae97e030be7e4a4dfcd4d6635 | [
"MIT"
] | 1 | 2020-03-31T07:24:01.000Z | 2020-03-31T07:24:01.000Z | import sys
sys.path.append('../')
layer1 = [Experiment,Production]
layer1_names = ['Experiment','Production']
Files = File
| 33.414634 | 75 | 0.658394 | import os
from utils.Template_directory import *
from utils.utilities import *
import sys
sys.path.append('../')
from core.Renderer.FileRenderer import Renderer
layer1 = [Experiment,Production]
layer1_names = ['Experiment','Production']
Files = File
def GetCurrentDirectory():
currentDirectory = os.getcwd()
ret... | 0 | 0 | 0 | 0 | 0 | 1,011 | 0 | 39 | 184 |
3235e687d4bb817652eb1ff22833902799497e16 | 332 | py | Python | 1-10/problem7.py | anpe9592/projectEuler | 628ae8877bca496d55b95bd55525478bede6e753 | [
"MIT"
] | null | null | null | 1-10/problem7.py | anpe9592/projectEuler | 628ae8877bca496d55b95bd55525478bede6e753 | [
"MIT"
] | null | null | null | 1-10/problem7.py | anpe9592/projectEuler | 628ae8877bca496d55b95bd55525478bede6e753 | [
"MIT"
] | null | null | null | # problem7.py
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10 001st prime number?
i = 1
z = 1
while i < 10002:
z += 1
if z > 1:
for j in range(2, z):
if z % j == 0:
break
else:
i += ... | 18.444444 | 102 | 0.490964 | # problem7.py
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10 001st prime number?
i = 1
z = 1
while i < 10002:
z += 1
if z > 1:
for j in range(2, z):
if z % j == 0:
break
else:
i += ... | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
c3dabb085af97c158d1e88e44c42684ccc05417d | 2,859 | py | Python | setup.py | ShivanshShalabh/zoomobot- | e2cf7a7bba5515248e5754702bb3daba626b615f | [
"MIT"
] | null | null | null | setup.py | ShivanshShalabh/zoomobot- | e2cf7a7bba5515248e5754702bb3daba626b615f | [
"MIT"
] | null | null | null | setup.py | ShivanshShalabh/zoomobot- | e2cf7a7bba5515248e5754702bb3daba626b615f | [
"MIT"
] | null | null | null | import os
if __name__ == '__main__':
# Check if file with name Cache.txt exists
if os.path.isfile('Cache.txt'):
# If file exists, delete it
os.remove('Cache.txt')
# Create file with name Cache.txt
name = input('Enter your name (Enter -1 to skip): ')
while not name:
name =... | 37.618421 | 138 | 0.582721 | import re
import os
def isValidHexaCode(str):
# Regex to check valid
# hexadecimal color code.
regex = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
# Compile the ReGex
p = re.compile(regex)
# If the string is empty
# return false
if(str == None):
return False
# Return if the str... | 0 | 0 | 0 | 0 | 0 | 382 | 0 | -12 | 45 |