hexsha stringlengths 40 40 | size int64 5 2.06M | ext stringclasses 11
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 251 | max_stars_repo_name stringlengths 4 130 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k โ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 โ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 โ | max_issues_repo_path stringlengths 3 251 | max_issues_repo_name stringlengths 4 130 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 116k โ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 โ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 โ | max_forks_repo_path stringlengths 3 251 | max_forks_repo_name stringlengths 4 130 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k โ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 โ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 โ | content stringlengths 1 1.05M | avg_line_length float64 1 1.02M | max_line_length int64 3 1.04M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
011929cc6bf535432cf049cfeb608476447f32f5 | 1,157 | py | Python | 202_happyNumber.py | stuti-rastogi/leetcode-python-solutions | 73593fe642a06a83cde974ba5e6de3a7b396ec84 | [
"MIT"
] | 4 | 2018-07-24T08:36:42.000Z | 2019-08-25T17:48:47.000Z | 202_happyNumber.py | stuti-rastogi/leetcodesolutions | 73593fe642a06a83cde974ba5e6de3a7b396ec84 | [
"MIT"
] | null | null | null | 202_happyNumber.py | stuti-rastogi/leetcodesolutions | 73593fe642a06a83cde974ba5e6de3a7b396ec84 | [
"MIT"
] | null | null | null |
# seen = []
# while (True):
# print (seen)
# digits = self.getDigits(n)
# total = 0
# print ("Digits: " + str(digits))
# for i in digits:
# total += int(pow(i,2))
# if (total in seen):
# return False
# if (total == 1):
# return True
# seen.append(total)
# n = total
# def getDigits(self, n):
# digits = []
# while (n > 0):
# digits.append(n%10)
# n = n//10
# return digits | 26.906977 | 46 | 0.395851 |
011acc08c0fc9cd09faf7e3c06fdec11827adac8 | 434 | py | Python | dataclazzes/playlist.py | navrudh/youtube-music-helper-scripts | 7bae74d698e15e11bac427e42bd0a21e08163f88 | [
"MIT"
] | null | null | null | dataclazzes/playlist.py | navrudh/youtube-music-helper-scripts | 7bae74d698e15e11bac427e42bd0a21e08163f88 | [
"MIT"
] | null | null | null | dataclazzes/playlist.py | navrudh/youtube-music-helper-scripts | 7bae74d698e15e11bac427e42bd0a21e08163f88 | [
"MIT"
] | null | null | null | from dataclasses import dataclass, field
from dataclazzes.track import Track
| 22.842105 | 72 | 0.663594 |
011b749c0cb7168d1d612e734d1940a1245eb56c | 9,091 | py | Python | entity.py | PIRXrav/pyhack | af5c86fb721053d8a3e819ab772c8144a23b86bf | [
"MIT"
] | null | null | null | entity.py | PIRXrav/pyhack | af5c86fb721053d8a3e819ab772c8144a23b86bf | [
"MIT"
] | null | null | null | entity.py | PIRXrav/pyhack | af5c86fb721053d8a3e819ab772c8144a23b86bf | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# pylint: disable=C0103
"""
Dfinie la classe entity
Permet de modeliser le personnage et des monstre
"""
from random import choice
from vect import Vect
from astar import calc_path_astart
import chars
def main():
"""
Test unitaire
"""
if __name__ == '__main__':
main()
| 24.438172 | 79 | 0.494995 |
011dbd3f8e4f3dc4a3cd128fe4d90224e86d26f2 | 3,488 | py | Python | apps/Ipo.py | KiloSat/FirstNivesh | 0fe200e08bb9f7d89de91f59eb14448fa7b972b9 | [
"MIT"
] | null | null | null | apps/Ipo.py | KiloSat/FirstNivesh | 0fe200e08bb9f7d89de91f59eb14448fa7b972b9 | [
"MIT"
] | null | null | null | apps/Ipo.py | KiloSat/FirstNivesh | 0fe200e08bb9f7d89de91f59eb14448fa7b972b9 | [
"MIT"
] | 2 | 2021-04-03T16:39:23.000Z | 2021-08-15T08:09:21.000Z | import streamlit as st
| 35.591837 | 109 | 0.610952 |
011ec6d9a369d9cd8fa960e87d7fc5aabbdb09f6 | 2,447 | py | Python | tests/test_unit_varfilter.py | gomibaya/pyVarfilter | 098414223e575dda3fabe7b8ccb1b16f6f8da3a0 | [
"MIT"
] | null | null | null | tests/test_unit_varfilter.py | gomibaya/pyVarfilter | 098414223e575dda3fabe7b8ccb1b16f6f8da3a0 | [
"MIT"
] | null | null | null | tests/test_unit_varfilter.py | gomibaya/pyVarfilter | 098414223e575dda3fabe7b8ccb1b16f6f8da3a0 | [
"MIT"
] | null | null | null | import unittest
import logging
from varfilter import varfilter, filter
if __name__ == '__main__':
logging.basicConfig(format='%(asctime)s - %(message)s',
level=logging.DEBUG)
unittest.main()
| 34.464789 | 73 | 0.495709 |
01203f70632858bfabcba480840b28432e8c773f | 4,989 | py | Python | tests/test_extensions/test_arithmatex.py | pawamoy/pymdown-extensions | 90de4c0c52456751141e898af3941c729914a80e | [
"MIT"
] | null | null | null | tests/test_extensions/test_arithmatex.py | pawamoy/pymdown-extensions | 90de4c0c52456751141e898af3941c729914a80e | [
"MIT"
] | null | null | null | tests/test_extensions/test_arithmatex.py | pawamoy/pymdown-extensions | 90de4c0c52456751141e898af3941c729914a80e | [
"MIT"
] | null | null | null | """Test cases for Arithmatex."""
from .. import util
| 28.83815 | 371 | 0.453999 |
012152e2a37577150f9d63f073997bc92e0bc861 | 197 | py | Python | source/applications/advanced/hand_eye_calibration/ur_hand_eye_calibration/3rdParty/rtde-2.3.6/setup.py | ebruun/python-samples | 746e5090f45659c60f01bf831a0308966d713b21 | [
"BSD-3-Clause"
] | 10 | 2020-12-03T22:59:39.000Z | 2022-03-27T07:31:42.000Z | source/applications/advanced/hand_eye_calibration/ur_hand_eye_calibration/3rdParty/rtde-2.3.6/setup.py | ebruun/python-samples | 746e5090f45659c60f01bf831a0308966d713b21 | [
"BSD-3-Clause"
] | 55 | 2019-07-23T09:05:27.000Z | 2020-11-02T14:42:55.000Z | source/applications/advanced/hand_eye_calibration/ur_hand_eye_calibration/3rdParty/rtde-2.3.6/setup.py | ebruun/python-samples | 746e5090f45659c60f01bf831a0308966d713b21 | [
"BSD-3-Clause"
] | 4 | 2020-01-09T08:36:23.000Z | 2020-09-12T20:28:31.000Z | # -*- coding: utf-8 -*-
from setuptools import setup
setup(
name="UrRtde",
packages=["rtde"],
version=1.0,
description="Real-Time Data Exchange (RTDE) python client + examples",
)
| 19.7 | 74 | 0.639594 |
0121afa2ee5440a70a9a651bed1ddda312a2e7ae | 891 | py | Python | code/roman2int.py | wp-lai/xpython | 3d90362e56173052d8dd66817feffd67dc07db91 | [
"MIT"
] | 5 | 2016-11-17T07:35:05.000Z | 2018-04-07T16:34:16.000Z | code/roman2int.py | wp-lai/xpython | 3d90362e56173052d8dd66817feffd67dc07db91 | [
"MIT"
] | null | null | null | code/roman2int.py | wp-lai/xpython | 3d90362e56173052d8dd66817feffd67dc07db91 | [
"MIT"
] | null | null | null | """
Task:
Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
Symbol Value
I 1 (unus)
V 5 (quinque)
X 10 (decem)
L 50 (quinquaginta)
C 100 (centum)
D 500 (quingenti)
M 1,000 (mille)
>>> roman_to_int("DCXXI")
621
>>> roman_to_int("VI")
6
>>> roman_to_int("LXXVI")
76
>>> roman_to_int("XIII")
13
>>> roman_to_int("MMMCMXCIX")
3999
>>> roman_to_int("")
0
"""
if __name__ == '__main__':
import doctest
doctest.testmod()
| 18.183673 | 62 | 0.539843 |
01243d69b6f9b70a1311214737f35975b0a644a4 | 2,082 | py | Python | test/test_upstream.py | bninja/rump | 3b6c4ff29974b3c04a260d8275567beebb296e5d | [
"0BSD"
] | 6 | 2015-07-27T09:02:36.000Z | 2018-07-18T11:11:33.000Z | test/test_upstream.py | bninja/rump | 3b6c4ff29974b3c04a260d8275567beebb296e5d | [
"0BSD"
] | null | null | null | test/test_upstream.py | bninja/rump | 3b6c4ff29974b3c04a260d8275567beebb296e5d | [
"0BSD"
] | null | null | null | import mock
import pytest
from rump import parser, Server, Upstream, Selection, exc
| 28.135135 | 66 | 0.583573 |
0124ac8c7a202aa897f92f830d9e99028d3f1d5a | 1,113 | py | Python | places/admin.py | moshthepitt/shulezote | e903a208948ab5294183e2a8c2dac9360a184654 | [
"MIT"
] | 2 | 2015-12-02T08:14:34.000Z | 2020-12-16T19:56:46.000Z | places/admin.py | moshthepitt/shulezote | e903a208948ab5294183e2a8c2dac9360a184654 | [
"MIT"
] | 4 | 2016-10-04T12:15:42.000Z | 2021-06-10T19:47:39.000Z | places/admin.py | moshthepitt/shulezote | e903a208948ab5294183e2a8c2dac9360a184654 | [
"MIT"
] | 1 | 2018-08-20T14:19:32.000Z | 2018-08-20T14:19:32.000Z | from django.contrib import admin
from places.models import County, Constituency, Province, District
from places.models import Division, Location, SubLocation, SchoolZone
admin.site.register(County, CountyAdmin)
admin.site.register(Province, ProvinceAdmin)
admin.site.register(District, DistrictAdmin)
admin.site.register(Division, DivisionAdmin)
admin.site.register(Constituency, ConstituencyAdmin)
admin.site.register(Location, LocationAdmin)
admin.site.register(SubLocation, SubLocationAdmin)
admin.site.register(SchoolZone, SchoolZoneAdmin)
| 24.195652 | 69 | 0.779874 |
0125022bc1c32fb48c4660789e204445cd4abb92 | 520 | py | Python | pygeems/__init__.py | arkottke/pygeems | 5bfb563dbc151dc7d7581c31de0061e564cf7d84 | [
"MIT"
] | 3 | 2019-01-11T04:44:29.000Z | 2022-01-05T01:09:46.000Z | pygeems/__init__.py | arkottke/pygeems | 5bfb563dbc151dc7d7581c31de0061e564cf7d84 | [
"MIT"
] | null | null | null | pygeems/__init__.py | arkottke/pygeems | 5bfb563dbc151dc7d7581c31de0061e564cf7d84 | [
"MIT"
] | 1 | 2021-02-21T17:29:21.000Z | 2021-02-21T17:29:21.000Z | """pyGEEMs: Geotechnical earthquake engineering models implemented in Python."""
import pathlib
from pkg_resources import get_distribution
import scipy.constants
FPATH_DATA = pathlib.Path(__file__).parent / "data"
KPA_TO_ATM = scipy.constants.kilo / scipy.constants.atm
__author__ = "Albert Kottke"
__copyright__ = "Copyright 2018 Albert Kottke"
__license__ = "MIT"
__title__ = "pygeems"
__version__ = get_distribution("pygeems").version
from . import dyn_props
from . import ground_motion
from . import slope_disp
| 26 | 80 | 0.796154 |
012579b5541f7896f0ff2928c89b8dec890eb8d1 | 414 | py | Python | Ago-Dic-2020/sena-martinez-angel-david/Primer Parcial/Gui.py | bryanbalderas/DAS_Sistemas | 1e31f088c0de7134471025a5730b0abfc19d936e | [
"MIT"
] | 41 | 2017-09-26T09:36:32.000Z | 2022-03-19T18:05:25.000Z | Ago-Dic-2020/sena-martinez-angel-david/Primer Parcial/Gui.py | bryanbalderas/DAS_Sistemas | 1e31f088c0de7134471025a5730b0abfc19d936e | [
"MIT"
] | 67 | 2017-09-11T05:06:12.000Z | 2022-02-14T04:44:04.000Z | Ago-Dic-2020/sena-martinez-angel-david/Primer Parcial/Gui.py | bryanbalderas/DAS_Sistemas | 1e31f088c0de7134471025a5730b0abfc19d936e | [
"MIT"
] | 210 | 2017-09-01T00:10:08.000Z | 2022-03-19T18:05:12.000Z | from tkinter import *
from tkinter.ttk import *
# creando ventana tkinter
root = Tk()
# Agregando herramientas a la ventana
Label(root, text = 'PuntosExtra', font =(
'Verdana', 15)).pack(side = TOP, pady = 10)
# Insertando la imagen de login
foto = PhotoImage(file = r"C:\Users\david\OneDrive\Imgenes\login.png")
Button(root, text = 'Click Me !', image = foto).pack(side = TOP)
mainloop() | 25.875 | 72 | 0.669082 |
012711b60afee7420df0f399f035f95d78d3df36 | 2,200 | py | Python | custom/ewsghana/urls.py | johan--/commcare-hq | 86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd | [
"BSD-3-Clause"
] | null | null | null | custom/ewsghana/urls.py | johan--/commcare-hq | 86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd | [
"BSD-3-Clause"
] | 1 | 2022-03-12T01:03:25.000Z | 2022-03-12T01:03:25.000Z | custom/ewsghana/urls.py | johan--/commcare-hq | 86ee99c54f55ee94e4c8f2f6f30fc44e10e69ebd | [
"BSD-3-Clause"
] | null | null | null | from django.conf.urls import patterns, url, include
from corehq.apps.api.urls import CommCareHqApi
from custom.ewsghana.resources.v0_1 import EWSLocationResource
from custom.ewsghana.views import EWSConfigView, EWSGlobalStats, InputStockView, EWSUserExtensionView, \
DashboardRedirectReportView
hq_api = CommCareHqApi(api_name='v0.3')
hq_api.register(EWSLocationResource())
urlpatterns = patterns('custom.ewsghana.views',
url(r'^ews_config/$', EWSConfigView.as_view(), name=EWSConfigView.urlname),
url(r'^sync_ewsghana/$', 'sync_ewsghana', name='sync_ewsghana'),
url(r'^global_stats/$', EWSGlobalStats.as_view(), name=EWSGlobalStats.urlname),
# for testing purposes
url(r'^ews_sync_stock_data/$', 'ews_sync_stock_data', name='ews_sync_stock_data'),
url(r'^ews_clear_stock_data/$', 'ews_clear_stock_data', name='ews_clear_stock_data'),
url(r'^configure_in_charge/$', 'configure_in_charge', name='configure_in_charge'),
url(r'^ews_resync_web_users/$', 'ews_resync_web_users', name='ews_resync_web_users'),
url(r'^inventory_managment/$', 'inventory_management', name='inventory_managment'),
url(r'^stockouts_product/$', 'stockouts_product', name='stockouts_product'),
url(r'^ews_fix_locations/$', 'ews_fix_locations', name='ews_fix_locations'),
url(r'^ews_add_products_to_locs/$', 'ews_add_products_to_locs', name='ews_add_products_to_locs'),
url(r'^migrate_email_settings/$', 'migrate_email_settings_view', name='migrate_email_settings'),
url(r'^fix_sms_users/$', 'fix_sms_users', name='fix_sms_users'),
url(r'^delete_last_stock_data/$', 'delete_last_stock_data', name='delete_last_stock_data'),
url(r'^(?P<site_code>\w+)/input_stock/$', InputStockView.as_view(), name='input_stock'),
url(r'^', include(hq_api.urls)),
url(r'^convert_user_data_fields/$', 'convert_user_data_fields', name='convert_user_data_fields'),
url(r'^non_administrative_locations/$', 'non_administrative_locations_for_select2'),
url(r'^user_settings/(?P<user_id>[ \w-]+)/$', EWSUserExtensionView.as_view(), name='ews_user_settings'),
url(r'^dashboard/(?P<site_code>\w+)/', DashboardRedirectReportView.as_view(), name='dashboard_report')
)
| 64.705882 | 108 | 0.753636 |
01274e1a8dfe413246f9258fed40ee9356e14195 | 9,288 | py | Python | ee559/hw2/classifier.py | chenying-wang/usc-ee-coursework-public | 5bc94c2350bcebf1036fb058fe7dc4f7e31e1de1 | [
"MIT"
] | 1 | 2021-03-24T10:46:20.000Z | 2021-03-24T10:46:20.000Z | ee559/hw2/classifier.py | chenying-wang/usc-ee-coursework-public | 5bc94c2350bcebf1036fb058fe7dc4f7e31e1de1 | [
"MIT"
] | null | null | null | ee559/hw2/classifier.py | chenying-wang/usc-ee-coursework-public | 5bc94c2350bcebf1036fb058fe7dc4f7e31e1de1 | [
"MIT"
] | 1 | 2021-03-25T09:18:45.000Z | 2021-03-25T09:18:45.000Z | import numpy as np
from scipy.spatial.distance import cdist
import sys
from plot_area import plot_area
COLOR = ['tab:blue', 'tab:orange', 'tab:green']
| 42.605505 | 135 | 0.602498 |
0127942a3e99b818d3bf03948c616cc5027b74c1 | 1,920 | py | Python | Web/discussManager.py | cmd2001/Open-TesutoHime | 2c30aa35650383adfb99496aebd425dffd287eda | [
"MIT"
] | 11 | 2020-11-28T16:45:35.000Z | 2021-08-31T07:56:26.000Z | Web/discussManager.py | cmd2001/Open-TesutoHime | 2c30aa35650383adfb99496aebd425dffd287eda | [
"MIT"
] | null | null | null | Web/discussManager.py | cmd2001/Open-TesutoHime | 2c30aa35650383adfb99496aebd425dffd287eda | [
"MIT"
] | 2 | 2021-05-16T03:09:58.000Z | 2021-08-21T07:24:58.000Z | import sys
from utils import *
Discuss_Manager = DiscussManager()
| 32 | 106 | 0.577604 |
0128d2dc205aef3ebf52d764565e44d09f889dd0 | 1,977 | py | Python | casimir/force_calc/force_calc_mc.py | charlesblakemore/opt_lev_analysis | 704f174e9860907de349688ed82b5812bbb07c2d | [
"MIT"
] | null | null | null | casimir/force_calc/force_calc_mc.py | charlesblakemore/opt_lev_analysis | 704f174e9860907de349688ed82b5812bbb07c2d | [
"MIT"
] | null | null | null | casimir/force_calc/force_calc_mc.py | charlesblakemore/opt_lev_analysis | 704f174e9860907de349688ed82b5812bbb07c2d | [
"MIT"
] | 1 | 2019-11-27T19:10:25.000Z | 2019-11-27T19:10:25.000Z | import math, sys, random, mcint
from scipy import integrate
import numpy as np
gap = float(sys.argv[1])
lam = float(sys.argv[2])
print(gap, lam)
## calculate the yukawa force over a distributed test mass assumed to be cube
D = 5 # diameter of bead (um)
rhob = 2e3 # density bead (kg/m^3)
rhoa = 19.3e3 # density attractor
rhosi = 2.3e3 # density attractor
a = 10 # length of attractor cube side (um)
a_depth = 200 # depth of attractor cube side (um)
au_thick = 0.2 # shield layer thickness (um)
alpha = 1.0
G = 6.67398e-11
#def Fg(phi, theta, r, currx, curry, currz):
nmc = 100000000
domainsize = D * math.pi**2 * a_depth * a**2
random.seed(1)
result, error = mcint.integrate(integrand, sampler(), measure=domainsize, n=nmc)
print("integral is: ", result, error)
#fname = 'data/lam_arr_%.3f_%.3f.npy' % (gap*1e6,lam*1e6)
#np.save(fname,intval)
| 27.082192 | 121 | 0.616591 |
012a1022a18b104991ad25c5bfeca0df7e5858c1 | 8,823 | py | Python | robot-server/robot_server/robot/calibration/tip_length/user_flow.py | Axel-Jacobsen/opentrons | c543d95c25003f2e784560efaa6a91f051d4cd33 | [
"Apache-2.0"
] | 1 | 2022-03-17T20:38:04.000Z | 2022-03-17T20:38:04.000Z | robot-server/robot_server/robot/calibration/tip_length/user_flow.py | Axel-Jacobsen/opentrons | c543d95c25003f2e784560efaa6a91f051d4cd33 | [
"Apache-2.0"
] | null | null | null | robot-server/robot_server/robot/calibration/tip_length/user_flow.py | Axel-Jacobsen/opentrons | c543d95c25003f2e784560efaa6a91f051d4cd33 | [
"Apache-2.0"
] | null | null | null | import logging
from typing import (
Dict, Awaitable, Callable, Any, Set, List, Optional,
TYPE_CHECKING)
from opentrons.types import Mount, Point, Location
from opentrons.config import feature_flags as ff
from opentrons.hardware_control import ThreadManager, CriticalPoint
from opentrons.protocol_api import labware
from opentrons.protocols.geometry import deck
from robot_server.robot.calibration import util
from robot_server.service.errors import RobotServerError
from robot_server.service.session.models.command import CalibrationCommand
from ..errors import CalibrationError
from ..helper_classes import RequiredLabware, AttachedPipette
from ..constants import (
TIP_RACK_LOOKUP_BY_MAX_VOL,
SHORT_TRASH_DECK,
STANDARD_DECK,
CAL_BLOCK_SETUP_BY_MOUNT,
MOVE_TO_TIP_RACK_SAFETY_BUFFER,
)
from .constants import TipCalibrationState as State, TIP_RACK_SLOT
from .state_machine import TipCalibrationStateMachine
if TYPE_CHECKING:
from opentrons_shared_data.labware import LabwareDefinition
MODULE_LOG = logging.getLogger(__name__)
"""
A collection of functions that allow a consumer to prepare and update
calibration data associated with the combination of a pipette tip type and a
unique (by serial number) physical pipette.
"""
# TODO: BC 2020-07-08: type all command logic here with actual Model type
COMMAND_HANDLER = Callable[..., Awaitable]
COMMAND_MAP = Dict[str, COMMAND_HANDLER]
def _get_tip_rack_lw(self,
tip_rack_def: 'LabwareDefinition') -> labware.Labware:
try:
return labware.load_from_definition(
tip_rack_def,
self._deck.position_for(TIP_RACK_SLOT))
except Exception:
raise RobotServerError(definition=CalibrationError.BAD_LABWARE_DEF)
def _get_alt_tip_racks(self) -> Set[str]:
pip_vol = self._hw_pipette.config.max_volume
return set(TIP_RACK_LOOKUP_BY_MAX_VOL[str(pip_vol)].alternatives)
| 38.867841 | 99 | 0.656693 |
012aa2038cdc99acbfdd28f90d56ceb7c6e6b261 | 1,572 | py | Python | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/WGL/ARB/pbuffer.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/WGL/ARB/pbuffer.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/WGL/ARB/pbuffer.py | JE-Chen/je_old_repo | a8b2f1ac2eec25758bd15b71c64b59b27e0bcda5 | [
"MIT"
] | null | null | null | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.WGL import _types as _cs
# End users want this...
from OpenGL.raw.WGL._types import *
from OpenGL.raw.WGL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_EXTENSION_NAME = 'WGL_ARB_pbuffer'
WGL_DRAW_TO_PBUFFER_ARB=_C('WGL_DRAW_TO_PBUFFER_ARB',0x202D)
WGL_MAX_PBUFFER_HEIGHT_ARB=_C('WGL_MAX_PBUFFER_HEIGHT_ARB',0x2030)
WGL_MAX_PBUFFER_PIXELS_ARB=_C('WGL_MAX_PBUFFER_PIXELS_ARB',0x202E)
WGL_MAX_PBUFFER_WIDTH_ARB=_C('WGL_MAX_PBUFFER_WIDTH_ARB',0x202F)
WGL_PBUFFER_HEIGHT_ARB=_C('WGL_PBUFFER_HEIGHT_ARB',0x2035)
WGL_PBUFFER_LARGEST_ARB=_C('WGL_PBUFFER_LARGEST_ARB',0x2033)
WGL_PBUFFER_LOST_ARB=_C('WGL_PBUFFER_LOST_ARB',0x2036)
WGL_PBUFFER_WIDTH_ARB=_C('WGL_PBUFFER_WIDTH_ARB',0x2034)
| 42.486486 | 111 | 0.811705 |
012c3b0eb2f715797ab316942c7962c44dea54d6 | 1,885 | py | Python | dj_warning_forms/forms.py | dnmellen/dj-warning-forms | 25213821f41ad6864cb7eda7bd2f6640d4418561 | [
"BSD-3-Clause"
] | 3 | 2022-03-15T09:09:08.000Z | 2022-03-23T12:30:47.000Z | dj_warning_forms/forms.py | dnmellen/dj-warning-forms | 25213821f41ad6864cb7eda7bd2f6640d4418561 | [
"BSD-3-Clause"
] | 1 | 2022-03-16T08:04:07.000Z | 2022-03-18T21:18:38.000Z | dj_warning_forms/forms.py | dnmellen/dj-warning-forms | 25213821f41ad6864cb7eda7bd2f6640d4418561 | [
"BSD-3-Clause"
] | null | null | null | from collections import namedtuple
import inspect
from django import forms
FormFieldWarning = namedtuple("FormFieldWarning", ["message", "description"])
| 33.660714 | 80 | 0.523607 |
012f17bafc339e27fe0149bdbf1a7b12a681ef93 | 29 | py | Python | demo2022.py | finaleo83/demo01 | 579782f564ab0f5cc95f6b5e63644c5f930c0019 | [
"Unlicense"
] | null | null | null | demo2022.py | finaleo83/demo01 | 579782f564ab0f5cc95f6b5e63644c5f930c0019 | [
"Unlicense"
] | null | null | null | demo2022.py | finaleo83/demo01 | 579782f564ab0f5cc95f6b5e63644c5f930c0019 | [
"Unlicense"
] | null | null | null | print("Hello, World! Again!") | 29 | 29 | 0.689655 |
01314db002cc9b5ea847e74d9af1164332434719 | 8,791 | py | Python | ai/ai.py | TED-996/pro-evolution-foosball | ced46dd7340664d7c7ca7679c6582c7636e2c2a8 | [
"MIT"
] | null | null | null | ai/ai.py | TED-996/pro-evolution-foosball | ced46dd7340664d7c7ca7679c6582c7636e2c2a8 | [
"MIT"
] | null | null | null | ai/ai.py | TED-996/pro-evolution-foosball | ced46dd7340664d7c7ca7679c6582c7636e2c2a8 | [
"MIT"
] | null | null | null | from numpy import array, arange, argmax
from numpy.random import choice
from itertools import product
from ai.NN import NN
import pickle
from random import random, randrange, randint
from collections import deque
from math import floor
| 41.079439 | 110 | 0.615402 |
013309a59e2c92190292c61529ffae1f691b50cb | 243 | py | Python | Desafio49.py | VictorCastao/Curso-em-Video-Python | aeee8baaa73c04b839a27ae37ba24ecc0b863075 | [
"MIT"
] | null | null | null | Desafio49.py | VictorCastao/Curso-em-Video-Python | aeee8baaa73c04b839a27ae37ba24ecc0b863075 | [
"MIT"
] | null | null | null | Desafio49.py | VictorCastao/Curso-em-Video-Python | aeee8baaa73c04b839a27ae37ba24ecc0b863075 | [
"MIT"
] | null | null | null | print('=' * 12 + 'Desafio 49' + '=' * 12)
numero = int(input('Digite o nmero para a tabuada: '))
print('=' * 13)
print(f'Tabuada do {numero}')
print('=' * 13)
for i in range(1,11):
print(f'{numero} x {i:2} = {numero * i}')
print('=' * 13) | 30.375 | 55 | 0.555556 |
01343ef465fcba8903301425b1e7414924d1fd27 | 1,686 | py | Python | Shared_Files/Music_Pallete.py | EricCacciavillani/LyreBird | 858657faef39d1adcba19ff0213210ba490b4afa | [
"MIT"
] | 1 | 2019-05-04T02:34:20.000Z | 2019-05-04T02:34:20.000Z | Shared_Files/Music_Pallete.py | EricCacciavillani/LyreBird | 858657faef39d1adcba19ff0213210ba490b4afa | [
"MIT"
] | null | null | null | Shared_Files/Music_Pallete.py | EricCacciavillani/LyreBird | 858657faef39d1adcba19ff0213210ba490b4afa | [
"MIT"
] | 1 | 2019-04-04T19:14:09.000Z | 2019-04-04T19:14:09.000Z | import pretty_midi
import sys
import numpy as np
from tqdm import tqdm
from collections import Counter
sys.path.append('..')
from Pre_Production.Midi_Pre_Processor import *
from Shared_Files.Global_Util import * | 33.058824 | 129 | 0.682681 |
01347244fcb03a5c18ef357b962ba9072723419d | 1,408 | py | Python | test/SIT/Bootstrap/TestBootstrap.py | antonelloceravola/ToolBOSCore | b03414a867a9f0585e06bb8e4f299c4be1357f3a | [
"BSD-3-Clause"
] | null | null | null | test/SIT/Bootstrap/TestBootstrap.py | antonelloceravola/ToolBOSCore | b03414a867a9f0585e06bb8e4f299c4be1357f3a | [
"BSD-3-Clause"
] | null | null | null | test/SIT/Bootstrap/TestBootstrap.py | antonelloceravola/ToolBOSCore | b03414a867a9f0585e06bb8e4f299c4be1357f3a | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# launches the unit testing
#
# Copyright (C)
# Honda Research Institute Europe GmbH
# Carl-Legien-Str. 30
# 63073 Offenbach/Main
# Germany
#
# UNPUBLISHED PROPRIETARY MATERIAL.
# ALL RIGHTS RESERVED.
#
#
import os
import tempfile
import unittest
from ToolBOSCore.Storage import SIT
from ToolBOSCore.Storage import CopyTreeFilter
from ToolBOSCore.Util import FastScript
from ToolBOSCore.Util import Any
if __name__ == '__main__':
unittest.main()
# EOF
| 22.349206 | 87 | 0.665483 |
0139cdb76dae20ff11cf54b33120c3d867395d2f | 9,566 | py | Python | GoogleCalendar.py | InRong/Glance | cc15659436bba2b4bee396b4a3e595a157f31401 | [
"Apache-2.0"
] | null | null | null | GoogleCalendar.py | InRong/Glance | cc15659436bba2b4bee396b4a3e595a157f31401 | [
"Apache-2.0"
] | null | null | null | GoogleCalendar.py | InRong/Glance | cc15659436bba2b4bee396b4a3e595a157f31401 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Module for adding Google Calendar Functionality.
#
# by Peter Juett
# References:https://developers.google.com/calendar/quickstart/python
#
# Copyright 2018
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import logging
from logging.handlers import RotatingFileHandler
import paho.mqtt.client as mqtt
import DB
import datetime
import time
import pytz
import os
from dateutil import parser
SLEEP_TIME = 60
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/calendar-python-quickstart.json
SCOPES = 'https://www.googleapis.com/auth/calendar.readonly'
CLIENT_SECRET_FILE = 'client_secret.json'
APPLICATION_NAME = 'Google Calendar API Python Quickstart'
if __name__ == '__main__':
run_program(None)
| 37.810277 | 146 | 0.569935 |
013c4fb306411e4299bc53f9a104c56ba9d36105 | 1,705 | py | Python | pypub/scrapers/jneuroscience.py | ScholarTools/pypub | 1fcdf895d4777aea7882a1812fef307255702a80 | [
"MIT"
] | 1 | 2016-07-03T17:53:54.000Z | 2016-07-03T17:53:54.000Z | pypub/scrapers/jneuroscience.py | ScholarTools/pypub | 1fcdf895d4777aea7882a1812fef307255702a80 | [
"MIT"
] | 8 | 2015-12-28T19:53:36.000Z | 2021-12-13T19:41:39.000Z | pypub/scrapers/jneuroscience.py | ScholarTools/pypub | 1fcdf895d4777aea7882a1812fef307255702a80 | [
"MIT"
] | 1 | 2016-06-21T15:08:46.000Z | 2016-06-21T15:08:46.000Z | # -*- coding: utf-8 -*-
"""
For an example page see:
http://www.jneurosci.org/content/23/10/4355.long#ref-list-1
Note that JNeuroscience seems to be part of a consortium with J Physiology,
J Neurophysiology, PNS, etc
perhaps check out HighWire Press?
"""
import requests
from bs4 import BeautifulSoup
| 31.574074 | 100 | 0.649853 |
013c7675c37f149bc9d81184f6cde81bed1535d6 | 1,089 | py | Python | fastapi-master-api/app/api/models/create_metric.py | SionAbes/fullstack-porfolio | 6ca74da425a0f6e2d9b65b2aeb8d5452ff1565a9 | [
"MIT"
] | 1 | 2021-12-25T09:19:25.000Z | 2021-12-25T09:19:25.000Z | fastapi-master-api/app/api/models/create_metric.py | SionAbes/fullstack-porfolio | 6ca74da425a0f6e2d9b65b2aeb8d5452ff1565a9 | [
"MIT"
] | null | null | null | fastapi-master-api/app/api/models/create_metric.py | SionAbes/fullstack-porfolio | 6ca74da425a0f6e2d9b65b2aeb8d5452ff1565a9 | [
"MIT"
] | null | null | null | # coding: utf-8
from __future__ import annotations
import re # noqa: F401
from datetime import date, datetime # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
CreateMetric.update_forward_refs()
| 30.25 | 96 | 0.708907 |
013c77d6a4350f96399efe1ca86c27a469b9fa59 | 32 | py | Python | src/logic_analyzer_bfms/__init__.py | pybfms/pybfms_logic_analyzer | 7696e16c53a7248a0660ba1cc8f108cda03c1e08 | [
"Apache-2.0"
] | null | null | null | src/logic_analyzer_bfms/__init__.py | pybfms/pybfms_logic_analyzer | 7696e16c53a7248a0660ba1cc8f108cda03c1e08 | [
"Apache-2.0"
] | null | null | null | src/logic_analyzer_bfms/__init__.py | pybfms/pybfms_logic_analyzer | 7696e16c53a7248a0660ba1cc8f108cda03c1e08 | [
"Apache-2.0"
] | 1 | 2020-11-22T08:37:39.000Z | 2020-11-22T08:37:39.000Z |
from .la_initiator_bfm import * | 16 | 31 | 0.8125 |
013c7f4681cad6f22cf85afe8bfe0932af367f65 | 6,940 | py | Python | postprocessing/science/compute_diff_seissol_data.py | jrekoske/SeisSol | 63087cf5fabc6e1b09a4d6b1e0ac46aaee2a1dfe | [
"BSD-3-Clause"
] | null | null | null | postprocessing/science/compute_diff_seissol_data.py | jrekoske/SeisSol | 63087cf5fabc6e1b09a4d6b1e0ac46aaee2a1dfe | [
"BSD-3-Clause"
] | null | null | null | postprocessing/science/compute_diff_seissol_data.py | jrekoske/SeisSol | 63087cf5fabc6e1b09a4d6b1e0ac46aaee2a1dfe | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python3
import h5py
import numpy as np
import argparse
import os
import seissolxdmf as sx
import seissolxdmfwriter as sw
# These 2 latter modules are on pypi (e.g. pip install seissolxdmf)
def read_reshape2d(sx, dataname):
"""read seissol dataset
and if there is only one time stamp
create a second dimension of size 1"""
myData = sx.ReadData(dataname)
if len(myData.shape) == 1:
myData = myData.reshape((1, myData.shape[0]))
return myData
def fuzzysort(arr, idx, dim=0, tol=1e-6):
"""
return indexes of sorted points robust to small perturbations of individual components.
https://stackoverflow.com/questions/19072110/numpy-np-lexsort-with-fuzzy-tolerant-comparisons
note that I added dim<arr.shape[0]-1 in some if statement (else it will crash sometimes)
"""
arrd = arr[dim]
srtdidx = sorted(idx, key=arrd.__getitem__)
i, ix = 0, srtdidx[0]
for j, jx in enumerate(srtdidx[1:], start=1):
if arrd[jx] - arrd[ix] >= tol:
if j - i > 1 and dim < arr.shape[0] - 1:
srtdidx[i:j] = fuzzysort(arr, srtdidx[i:j], dim + 1, tol)
i, ix = j, jx
if i != j and dim < arr.shape[0] - 1:
srtdidx[i:] = fuzzysort(arr, srtdidx[i:], dim + 1, tol)
return srtdidx
def lookup_sorted_geom(geom):
"""return the indices to sort the
geometry array by x, then y, then z
and the associated inverse look-up table
"""
ind = fuzzysort(geom.T, list(range(0, geom.shape[0])), tol=1e-4)
# generate inverse look-up table
dic = {i: index for i, index in enumerate(ind)}
ind_inv = np.zeros_like(ind)
for k, v in dic.items():
ind_inv[v] = k
return ind, ind_inv
def return_sorted_geom_connect(sx):
"""sort geom array and reindex connect array to match the new geom array"""
geom, connect = read_geom_connect(sx)
nv = geom.shape[0]
try:
import pymesh
geom, connect, inf = pymesh.remove_duplicated_vertices_raw(
geom, connect, tol=1e-4
)
print(f"removed {inf['num_vertex_merged']} duplicates out of {nv}")
except ModuleNotFoundError:
print("pymesh not found, trying trimesh...")
import trimesh
trimesh.tol.merge = 1e-4
mesh = trimesh.Trimesh(geom, connect)
mesh.merge_vertices()
geom = mesh.vertices
connect = mesh.faces
print(f"removed {nv-geom.shape[0]} duplicates out of {nv}")
ind, ind_inv = lookup_sorted_geom(geom)
geom = geom[ind, :]
connect = np.array([ind_inv[x] for x in connect.flatten()]).reshape(connect.shape)
# sort along line (then we can use multidim_intersect)
connect = np.sort(connect, axis=1)
return geom, connect
def multidim_intersect(arr1, arr2):
"""find indexes of same triangles in 2 connect arrays
(associated with the same geom array)
generate 1D arrays of tuples and use numpy function
https://stackoverflow.com/questions/9269681/intersection-of-2d-numpy-ndarrays
"""
arr1_view = arr1.view([("", arr1.dtype)] * arr1.shape[1])
arr2_view = arr2.view([("", arr2.dtype)] * arr2.shape[1])
intersected, ind1, ind2 = np.intersect1d(arr1_view, arr2_view, return_indices=True)
ni, n1, n2 = intersected.shape[0], arr1.shape[0], arr2.shape[0]
print(
f"{ni} faces in common, n faces connect 1:{n1}, 2:{n2} (diff: {n1-ni}, {n2-ni})"
)
return ind1, ind2
parser = argparse.ArgumentParser(
description="make difference between 2 (paraview) output files: f2-f1. \
The output must be from the same mesh, but the partionning may differ."
)
parser.add_argument("xdmf_filename1", help="filename1")
parser.add_argument("xdmf_filename2", help="filename2")
parser.add_argument(
"--idt",
nargs="+",
required=True,
help="list of time step to differenciate (1st = 0); -1 = all",
type=int,
)
parser.add_argument(
"--Data",
nargs="+",
required=True,
metavar=("variable"),
help="Data to differenciate (example SRs); all for all stored quantities",
)
parser.add_argument(
"--ratio",
dest="ratio",
default=False,
action="store_true",
help="compute relative ratio (f1-f2)/f1 instead of f2-f1",
)
args = parser.parse_args()
sx1 = sx.seissolxdmf(args.xdmf_filename1)
sx2 = sx.seissolxdmf(args.xdmf_filename2)
same_geom = same_geometry(sx1, sx2)
if same_geom:
print("same indexing detected, no need to reindex arrays")
geom1, connect1 = read_geom_connect(sx1)
geom2, connect2 = read_geom_connect(sx2)
else:
geom1, connect1 = return_sorted_geom_connect(sx1)
geom2, connect2 = return_sorted_geom_connect(sx2)
if not np.all(np.isclose(geom1, geom2, rtol=1e-3, atol=1e-4)):
raise ValueError("geometry arrays differ")
ind1, ind2 = multidim_intersect(connect1, connect2)
connect1 = connect1[ind1, :]
if args.idt[0] == -1:
args.idt = list(range(0, sx1.ndt))
aData = []
if args.Data == ["all"]:
variable_names = set()
for elem in sx1.tree.iter():
if elem.tag == "Attribute":
variable_names.add(elem.get("Name"))
variable_names2 = set()
for elem in sx2.tree.iter():
if elem.tag == "Attribute":
variable_names2.add(elem.get("Name"))
# return only variables in common
variable_names = variable_names.intersection(variable_names2)
for to_remove in ["partition", "locationFlag"]:
if to_remove in variable_names:
variable_names.remove(to_remove)
else:
variable_names = args.Data
for dataname in variable_names:
print(dataname)
myData1 = read_reshape2d(sx1, dataname)
myData2 = read_reshape2d(sx2, dataname)
ndt = min(myData1.shape[0], myData2.shape[0])
if same_geom:
myData = myData1[0:ndt, :] - myData2[0:ndt, :]
if args.ratio:
myData = myData / myData1[0:ndt, :]
else:
myData = myData1[0:ndt, ind1] - myData2[0:ndt, ind2]
if args.ratio:
myData = myData / myData1[0:ndt, ind1]
for idt in args.idt:
if idt < ndt:
print(idt, np.amin(myData[idt, :]), np.amax(myData[idt, :]))
else:
print(f"removing idt={idt}>{ndt} from args.idt")
args.idt.pop(idt)
aData.append(myData)
prefix, ext = os.path.splitext(args.xdmf_filename1)
add2prefix = "ratio" if args.ratio else "diff"
fname = f"{add2prefix}_{os.path.basename(prefix)}"
try:
dt = sx1.ReadTimeStep()
except NameError:
dt = 0.0
out_names = ["diff_" + name for name in variable_names]
sw.write_seissol_output(fname, geom1, connect1, out_names, aData, dt, args.idt)
| 31.689498 | 97 | 0.65072 |
013d0a444d8fcc0b669cdc39b7c00090f97916cd | 110 | py | Python | iFarm/iFarmapp/urls.py | vmakar0v/smart-farm | 47bd7be4b40bbca57492ae5b8da09cc0635bfa2a | [
"Apache-2.0"
] | null | null | null | iFarm/iFarmapp/urls.py | vmakar0v/smart-farm | 47bd7be4b40bbca57492ae5b8da09cc0635bfa2a | [
"Apache-2.0"
] | null | null | null | iFarm/iFarmapp/urls.py | vmakar0v/smart-farm | 47bd7be4b40bbca57492ae5b8da09cc0635bfa2a | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from . import views
urlpatterns = [
path('', views.home_P, name='home_P')
]
| 15.714286 | 41 | 0.681818 |
013dad2ac33defe55487634726ea099424ed06bd | 538 | py | Python | yandex/yandex2016_b_b.py | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | 1 | 2018-11-12T15:18:55.000Z | 2018-11-12T15:18:55.000Z | yandex/yandex2016_b_b.py | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | null | null | null | yandex/yandex2016_b_b.py | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | null | null | null | max_bitlen = int(1<<31).bit_length()
L, R = map(int, input().split())
ans = [(r - l) * 2 > (R - L + 1) for l, r in zip(count_bit_sum(L-1), count_bit_sum(R))]
print(sum(x * (1 << i) for i, x in enumerate(ans)))
| 38.428571 | 93 | 0.539033 |
013ea56ed2c4a516c4e4235a0ba8239ea63b5e56 | 2,639 | py | Python | gnuradio-3.7.13.4/gr-filter/python/filter/design/api_object.py | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | 1 | 2021-03-09T07:32:37.000Z | 2021-03-09T07:32:37.000Z | gnuradio-3.7.13.4/gr-filter/python/filter/design/api_object.py | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | null | null | null | gnuradio-3.7.13.4/gr-filter/python/filter/design/api_object.py | v1259397/cosmic-gnuradio | 64c149520ac6a7d44179c3f4a38f38add45dd5dc | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
| 32.9875 | 70 | 0.635847 |
013f03299525978dd3d212a41f6f91fa29b63b14 | 1,262 | py | Python | classes/announcement.py | jamflcjamflc/TopRace | 5c02941c8787884302a91f33f6b26bbdc13d79ce | [
"Apache-2.0"
] | null | null | null | classes/announcement.py | jamflcjamflc/TopRace | 5c02941c8787884302a91f33f6b26bbdc13d79ce | [
"Apache-2.0"
] | null | null | null | classes/announcement.py | jamflcjamflc/TopRace | 5c02941c8787884302a91f33f6b26bbdc13d79ce | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf8 -*-
# announcement
# helper class for toprace
# Alfredo Martin 2021
import pygame
version = 'announcement.v.1.0.0'
if __name__ == '__main__':
print(version)
| 28.681818 | 80 | 0.594295 |
013f53227578c72e73628747ce0b65e0ad1aa92b | 3,633 | py | Python | policies/regularizers.py | IST-DASLab/ACDC | ac53210b6adc1f2506ff909de08172ed9cad25d5 | [
"Apache-2.0"
] | 6 | 2021-11-26T01:21:03.000Z | 2022-01-10T15:41:50.000Z | policies/regularizers.py | IST-DASLab/ACDC | ac53210b6adc1f2506ff909de08172ed9cad25d5 | [
"Apache-2.0"
] | 1 | 2021-11-28T10:51:08.000Z | 2021-11-30T01:30:29.000Z | policies/regularizers.py | IST-DASLab/ACDC | ac53210b6adc1f2506ff909de08172ed9cad25d5 | [
"Apache-2.0"
] | 1 | 2021-12-21T13:25:43.000Z | 2021-12-21T13:25:43.000Z | """
Implement regularization policies here
"""
import torch
import torch.nn as nn
from policies.policy import PolicyBase
import logging
def build_reg_from_config(model, reg_config):
"""
This function build regularizer given the model (only need for weigths typically)
and regularizer configuration.
"""
reg_class = reg_config['class']
reg_args = {k: v for k, v in reg_config.items() if k != 'class'}
reg = globals()[reg_class](model, **reg_args)
return reg
def build_regs_from_config(model, config):
"""
This function takes *general* config file for current run and model
and returns a list of regularizers which are build by build_reg_from_config.
Example config.yaml for pruner instances:
>>> regularizers:
>>> reg1:
>>> class: Hoyer # regularization method to use
>>> lambda: 1e-6 # regularization coefficient
>>> modules: [net.0] # modules to apply regularization
>>> weight_only: True # if regularizer is applied only to weights of module (no bias)
>>> reg2:
>>> class: HoyerSquare
>>> lambda: 1e-6
>>> modules: [net.2]
>>> weight_only: True
"""
if 'regularizers' not in config: return []
regs_config = config['regularizers']
regs = [build_reg_from_config(model, reg_config)
for reg_config in regs_config.values()]
return regs
if __name__ == '__main__':
pass | 33.330275 | 93 | 0.624002 |
013fd9370c82568c8a3976632bf333b9c95292c6 | 938 | py | Python | coupons/models.py | sLeeNguyen/sales-support | 3f0a6977c8c26743373a70b4296516b7a71ccf4a | [
"Apache-2.0"
] | 1 | 2021-03-22T14:07:30.000Z | 2021-03-22T14:07:30.000Z | coupons/models.py | sLeeNguyen/sales-support | 3f0a6977c8c26743373a70b4296516b7a71ccf4a | [
"Apache-2.0"
] | null | null | null | coupons/models.py | sLeeNguyen/sales-support | 3f0a6977c8c26743373a70b4296516b7a71ccf4a | [
"Apache-2.0"
] | null | null | null | from django.db import models
from django.utils import timezone
from stores.models import Store
| 33.5 | 90 | 0.686567 |
014128990469de76bed3ac346da105ea98a96243 | 5,527 | py | Python | web_api/bearings/resources/inventory.py | zhanghe06/flask_restful | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | [
"MIT"
] | 1 | 2020-12-04T03:15:47.000Z | 2020-12-04T03:15:47.000Z | web_api/bearings/resources/inventory.py | zhanghe06/flask_restful | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | [
"MIT"
] | 1 | 2021-06-01T22:24:27.000Z | 2021-06-01T22:24:27.000Z | web_api/bearings/resources/inventory.py | zhanghe06/flask_restful | 6ef54f3f7efbbaff6169e963dcf45ab25e11e593 | [
"MIT"
] | 2 | 2020-12-04T03:16:18.000Z | 2021-09-04T14:10:12.000Z | #!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: inventory.py
@time: 2018-06-28 00:22
"""
from __future__ import unicode_literals
from flask import jsonify, make_response
from flask_restful import Resource, marshal, reqparse
from web_api.bearings.outputs.inventory import fields_item_inventory
from web_api.bearings.reqparsers.inventory import (
request_parser,
request_parser_item_post,
request_parser_item_put,
structure_key_item,
structure_key_items,
)
from web_api.commons.exceptions import BadRequest, NotFound
from web_api.bearings.apis.inventory import (
get_inventory_row_by_id,
edit_inventory,
delete_inventory,
get_inventory_limit_rows_by_last_id,
add_inventory,
get_inventory_pagination,
)
from web_api.commons.http_token_auth import token_auth
from web_api import app
SUCCESS_MSG = app.config['SUCCESS_MSG']
FAILURE_MSG = app.config['FAILURE_MSG']
| 30.368132 | 106 | 0.616971 |
01417896f15a60c73ebefea3a8b55b1d8117b7c4 | 2,141 | py | Python | bob/db/swan/query_bio.py | bioidiap/bob.db.swan | 676510d47cb08b65be04f51d45746127c36bf2ce | [
"BSD-3-Clause"
] | null | null | null | bob/db/swan/query_bio.py | bioidiap/bob.db.swan | 676510d47cb08b65be04f51d45746127c36bf2ce | [
"BSD-3-Clause"
] | null | null | null | bob/db/swan/query_bio.py | bioidiap/bob.db.swan | 676510d47cb08b65be04f51d45746127c36bf2ce | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# from bob.bio.spear.database import AudioBioFile
import bob.bio.base
import bob.io.base
import bob.io.video
from bob.extension import rc
from .common import SwanVideoFile, SwanAudioFile, SwanVideoDatabase
# class SwanAudioBioFile(SwanAudioFile, AudioBioFile):
# """SwanAudioBioFile are video files actually"""
| 38.927273 | 79 | 0.683793 |
0145f0c317a0b7c0a803c27a724e95a60c8be847 | 226 | py | Python | example.py | austitech/Tokenizer | 005bd6772ef3298b222c05e3357bf22961978a57 | [
"MIT"
] | null | null | null | example.py | austitech/Tokenizer | 005bd6772ef3298b222c05e3357bf22961978a57 | [
"MIT"
] | null | null | null | example.py | austitech/Tokenizer | 005bd6772ef3298b222c05e3357bf22961978a57 | [
"MIT"
] | null | null | null | from tokenizer import StringTokenizer
from token import tokentype
text = open('test.ex', 'r').read()
t = StringTokenizer(text=text, tokentype=tokentype)
token_generator = t.create_token_generator()
print(token_generator)
| 18.833333 | 51 | 0.783186 |
014639d9ec97c6ecdda8d9da8e1c9b7abc9b6d28 | 2,008 | py | Python | scripts/smilx_pv_visualisation.py | aneube/smili-spine | 3cd8f95077d4bc1f5ac6146bc5356c3131f22e4b | [
"BSD-2-Clause"
] | 17 | 2015-03-09T19:22:07.000Z | 2021-05-24T20:25:08.000Z | scripts/smilx_pv_visualisation.py | oddway/smili | 4205b08e5fdcf5ae4fa94747a6dbeac0bb5e0cf0 | [
"BSD-2-Clause"
] | 16 | 2015-08-20T03:30:15.000Z | 2019-10-22T12:21:14.000Z | scripts/smilx_pv_visualisation.py | oddway/smili | 4205b08e5fdcf5ae4fa94747a6dbeac0bb5e0cf0 | [
"BSD-2-Clause"
] | 11 | 2015-06-22T00:11:01.000Z | 2021-12-26T21:29:52.000Z | #!/usr/bin/smilx
'''=========================================================================
The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO)
ABN 41 687 119 230.
All rights reserved.
Licensed under the CSIRO BSD 3-Clause License
You may not use this file except in compliance with the License.
You may obtain a copy of the License in the file LICENSE.md or at
https://stash.csiro.au/projects/SMILI/repos/smili/browse/license.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
========================================================================='''
'''
This script opens a pv map and its corresponding image, thresholds and overlays the two, loads camera view, links windows and disables interpolation.
To use it, run smilx, in python console type "execfile('smilx_pv_visualisation.py')"
'''
#names of images, set them to empty string to get popup dialogs
imageName = "PAVEL_FLAWS_INV2.nii.gz"
pvImageName = "PAVEL_BiExp_Combined_PV_GM.nii.gz"
tmpOutName = "thresholded_pvimage.nii.gz"
MainWindow.loadFile(imageName) # load image
image = MainWindow.activeImage() # get pointer to image window
MainWindow.loadFile(pvImageName) # load image
pvImage = MainWindow.activeImage() # get pointer to image window
#process pv map for display
belowLevel = 0.01
aboveLevel = 0.25
pvImage.binaryThreshold(255, belowLevel, aboveLevel)
milxQtFile.saveImage(tmpOutName, pvImage) # save result
#overlay the pv processed result
pvImage.viewToSagittal()
pvImage.loadView("camera.cam")
pvImage.interpolateDisplay()
image.overlay(tmpOutName)
image.viewToSagittal()
image.loadView("camera.cam")
image.interpolateDisplay()
MainWindow.tileTab()
MainWindow.link() #link all the windows
| 38.615385 | 149 | 0.728586 |
014640d43ebc7a1a3b58c97712655fc4e51f491b | 6,887 | py | Python | src/genie/libs/parser/iosxe/tests/ShowPlatformSoftwareFed/cli/equal/golden_output3_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 204 | 2018-06-27T00:55:27.000Z | 2022-03-06T21:12:18.000Z | src/genie/libs/parser/iosxe/tests/ShowPlatformSoftwareFed/cli/equal/golden_output3_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 468 | 2018-06-19T00:33:18.000Z | 2022-03-31T23:23:35.000Z | src/genie/libs/parser/iosxe/tests/ShowPlatformSoftwareFed/cli/equal/golden_output3_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 309 | 2019-01-16T20:21:07.000Z | 2022-03-30T12:56:41.000Z | expected_output ={
"lentry_label": {
24: {
"aal": {
"deagg_vrf_id": 0,
"eos0": {"adj_hdl": "0xf9000002", "hw_hdl": "0x7f02737e2ca8"},
"eos1": {"adj_hdl": "0xf9000002", "hw_hdl": "0x7f02737e2a98"},
"id": 1996488716,
"lbl": 24,
"lspa_handle": "0",
},
"adj": {
109: {
"adj": "0xdf000026",
"ifnum": "0x33",
"link_type": "MPLS",
"si": "0x7f0273423ab8",
},
139: {
"adj": "0x5c000037",
"ifnum": "0x36",
"link_type": "MPLS",
"si": "0x7f02737a2348",
},
},
"backwalk_cnt": 0,
"label": {
31: {
"adj_handle": "0x62000061",
"bwalk_cnt": 0,
"collapsed_oce": 0,
"flags": {"0x1": ["REAL"]},
"label_aal": {
1644167265: {
"adj_flags": "0",
"di_id": "0x526d",
"dmac": "0027.90bf.2ee7",
"label_type": 2,
"lbl": 0,
"link_type": 2,
"phdl": "0xab000447",
"ref_cnt": 1,
"rewrite_type": "PSH1(119)",
"ri": "0x7f02737e8a98",
"ri_id": "0x4e",
"si": "0x7f02737c1b08",
"si_id": "0x4034",
"smac": "00a7.42d6.c41f",
"sub_type": 0,
"vlan_id": 0,
"vrf_id": 0,
}
},
"link_type": "MPLS",
"local_adj": 0,
"local_label": 24,
"modify_cnt": 0,
"olbl_changed": 0,
"outlabel": "(34, 0)",
"pdflags": {"0": ["INSTALL_HW_OK"]},
"subwalk_cnt": 0,
"unsupported_recursion": 0,
},
32: {
"adj_handle": "0x89000062",
"bwalk_cnt": 0,
"collapsed_oce": 0,
"flags": {"0x1": ["REAL"]},
"label_aal": {
2298478690: {
"adj_flags": "0",
"di_id": "0x5268",
"dmac": "00a7.42ce.f69f",
"label_type": 2,
"lbl": 0,
"link_type": 2,
"phdl": "0x7c000442",
"ref_cnt": 1,
"rewrite_type": "PSH1(119)",
"ri": "0x7f027379b138",
"ri_id": "0x24",
"si": "0x7f02737a4d58",
"si_id": "0x4035",
"smac": "00a7.42d6.c41f",
"sub_type": 0,
"vlan_id": 0,
"vrf_id": 0,
}
},
"link_type": "MPLS",
"local_adj": 0,
"local_label": 24,
"modify_cnt": 0,
"olbl_changed": 0,
"outlabel": "(29, 0)",
"pdflags": {"0": ["INSTALL_HW_OK"]},
"subwalk_cnt": 0,
"unsupported_recursion": 0,
},
},
"lb": {
38: {
"aal": {
"af": 0,
"ecr_id": 4177526786,
"ecr_type": "0",
"ecrh": "0x7f02737e49f8(28:2)",
"hwhdl": ":1937656312 "
"::0x7f02737e11c8,0x7f02737e2728,0x7f02737e11c8,0x7f02737e2728",
"ref": 3,
},
"bwalk": {"in_prog": 0, "nested": 0, "req": 0},
"bwalk_cnt": 0,
"ecr_map_objid": 0,
"ecrh": "0xf9000002",
"finish_cnt": 0,
"flags": "0",
"link_type": "IP",
"local_label": 24,
"modify_cnt": 0,
"mpls_ecr": 1,
"num_choices": 2,
"old_ecrh": "0",
"path_inhw": 2,
"subwalk_cnt": 0,
}
},
"lentry_hdl": "0x7700000c",
"lspa_handle": "0",
"modify_cnt": 8,
"nobj": ["LB", " 38"],
"sw_enh_ecr_scale": {
38: {
"adjs": 2,
"ecr_adj": {
1644167265: {
"adj_lentry": "[eos0:0x7f02734123b8 "
"eos1:0x7f02737ec5e8]",
"di_id": 20499,
"is_mpls_adj": 1,
"l3adj_flags": "0x100000",
"recirc_adj_id": 3120562239,
"rih": "0x7f02737e0bf8(74)",
"sih": "0x7f02737e11c8(182)",
},
2298478690: {
"adj_lentry": "[eos0:0x7f02737e6dd8 "
"eos1:0x7f02737b21d8]",
"di_id": 20499,
"is_mpls_adj": 1,
"l3adj_flags": "0x100000",
"recirc_adj_id": 1442840640,
"rih": "0x7f02737dcbe8(75)",
"sih": "0x7f02737e2728(183)",
},
2483028067: {
"di_id": 20499,
"rih": "0x7f02737eaa18(52)",
"sih": "0x7f02737e4c08(170)",
},
},
"ecr_hwhdl": "0x7f02737e49f8",
"ecrhdl": "0xf9000002",
"eos": 1,
"llabel": 24,
"mixed_adj": "0",
"mod_cnt": 0,
"pmismatch": 0,
"pordermatch": 0,
"prev_npath": 0,
"reprogram_hw": "0",
}
},
}
}
}
| 38.909605 | 88 | 0.283287 |
0146de801330617849875f5bc5ee04e2b90625fa | 3,610 | py | Python | tests/test_simulator_utility.py | tancheng/cache-sim | adfcbec961543a8424988cbadacb575c551f3cc3 | [
"MIT"
] | 27 | 2016-02-06T20:49:19.000Z | 2021-11-02T03:11:26.000Z | tests/test_simulator_utility.py | tancheng/cache-sim | adfcbec961543a8424988cbadacb575c551f3cc3 | [
"MIT"
] | 5 | 2020-02-24T18:57:11.000Z | 2021-09-01T00:27:18.000Z | tests/test_simulator_utility.py | tancheng/cache-sim | adfcbec961543a8424988cbadacb575c551f3cc3 | [
"MIT"
] | 16 | 2016-02-06T20:49:06.000Z | 2022-01-14T02:49:14.000Z | #!/usr/bin/env python3
import nose.tools as nose
from cachesimulator.bin_addr import BinaryAddress
from cachesimulator.word_addr import WordAddress
def test_get_bin_addr_unpadded():
"""get_bin_addr should return unpadded binary address of word address"""
nose.assert_equal(
BinaryAddress(word_addr=WordAddress(180)),
'10110100')
def test_get_bin_addr_padded():
"""get_bin_addr should return padded binary address of word address"""
nose.assert_equal(
BinaryAddress(word_addr=WordAddress(44), num_addr_bits=8),
'00101100')
def test_prettify_bin_addr_16_bit():
"""prettify_bin_addr should prettify 8-bit string into groups of 3"""
nose.assert_equal(
BinaryAddress.prettify('1010101110101011', min_bits_per_group=3),
'1010 1011 1010 1011')
def test_prettify_bin_addr_8_bit():
"""prettify_bin_addr should prettify 8-bit string into groups of 3"""
nose.assert_equal(
BinaryAddress.prettify('10101011', min_bits_per_group=3),
'1010 1011')
def test_prettify_bin_addr_7_bit():
"""prettify_bin_addr should prettify 7-bit string into groups of 3"""
nose.assert_equal(
BinaryAddress.prettify('1011010', min_bits_per_group=3),
'101 1010')
def test_prettify_bin_addr_6_bit():
"""prettify_bin_addr should prettify 6-bit string into groups of 3"""
nose.assert_equal(
BinaryAddress.prettify('101011', min_bits_per_group=3),
'101 011')
def test_prettify_bin_addr_5_bit():
"""prettify_bin_addr should prettify 5-bit string into groups of 3"""
nose.assert_equal(
BinaryAddress.prettify('10110', min_bits_per_group=3),
'10110')
def test_get_tag_5_bit():
"""get_tag should return correct 5 tag bits for an address"""
nose.assert_equal(
BinaryAddress('10110100').get_tag(num_tag_bits=5),
'10110')
def test_get_tag_0_bit():
"""get_tag should return None if no bits are allocated to a tag"""
nose.assert_is_none(
BinaryAddress('10110100').get_tag(num_tag_bits=0))
def test_get_index_2_bit():
"""get_index should return correct 2 index bits for an address"""
nose.assert_equal(
BinaryAddress('11111101').get_index(
num_offset_bits=1, num_index_bits=2), '10')
def test_get_index_0_bit():
"""get_index should return None if no bits are allocated to an index"""
nose.assert_is_none(
BinaryAddress('11111111').get_index(
num_offset_bits=1, num_index_bits=0))
def test_get_offset_2_bit():
"""get_offset should return correct 2 offset bits for an address"""
nose.assert_equal(
BinaryAddress('11111101').get_offset(num_offset_bits=2), '01')
def test_get_offset_0_bit():
"""get_offset should return None if no bits are allocated to an offset"""
nose.assert_is_none(
BinaryAddress('10110100').get_offset(num_offset_bits=0))
def test_get_consecutive_words_1_word():
"""get_consecutive_words should return same word for 1-word blocks"""
nose.assert_equal(
WordAddress(23).get_consecutive_words(num_words_per_block=1),
[23])
def test_get_consecutive_words_2_word():
"""get_consecutive_words should return correct words for 2-word blocks"""
nose.assert_equal(
WordAddress(22).get_consecutive_words(num_words_per_block=2),
[22, 23])
def test_get_consecutive_words_4_word():
"""get_consecutive_words should return correct words for 4-word blocks"""
nose.assert_equal(
WordAddress(21).get_consecutive_words(num_words_per_block=4),
[20, 21, 22, 23])
| 31.12069 | 77 | 0.713573 |
0146ed0b2f2154ab28c5b238a6e0624fb4e5747e | 10,347 | py | Python | stubs.min/System/Windows/__init___parts/Vector.py | denfromufa/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | 1 | 2017-07-07T11:15:45.000Z | 2017-07-07T11:15:45.000Z | stubs.min/System/Windows/__init___parts/Vector.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | stubs.min/System/Windows/__init___parts/Vector.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | def Negate(self):
"""
Negate(self: Vector)
Negates this vector. The vector has the same magnitude as before,but its
direction is now opposite.
"""
pass
def Normalize(self):
"""
Normalize(self: Vector)
Normalizes this vector.
"""
pass
def ToString(self,provider=None):
"""
ToString(self: Vector,provider: IFormatProvider) -> str
Returns the string representation of this System.Windows.Vector structure with
the specified formatting information.
provider: The culture-specific formatting information.
Returns: A string that represents the System.Windows.Vector.X and
System.Windows.Vector.Y values of this System.Windows.Vector.
ToString(self: Vector) -> str
Returns the string representation of this System.Windows.Vector structure.
Returns: A string that represents the System.Windows.Vector.X and
System.Windows.Vector.Y values of this System.Windows.Vector.
"""
pass
def __add__(self,*args):
""" x.__add__(y) <==> x+yx.__add__(y) <==> x+y """
pass
def __div__(self,*args):
""" x.__div__(y) <==> x/y """
pass
def __eq__(self,*args):
""" x.__eq__(y) <==> x==y """
pass
def __format__(self,*args):
""" __format__(formattable: IFormattable,format: str) -> str """
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
def __mul__(self,*args):
""" x.__mul__(y) <==> x*yx.__mul__(y) <==> x*yx.__mul__(y) <==> x*y """
pass
def __neg__(self,*args):
""" x.__neg__() <==> -x """
pass
def __radd__(self,*args):
"""
__radd__(vector1: Vector,vector2: Vector) -> Vector
Adds two vectors and returns the result as a vector.
vector1: The first vector to add.
vector2: The second vector to add.
Returns: The sum of vector1 and vector2.
"""
pass
def __repr__(self,*args):
""" __repr__(self: object) -> str """
pass
def __rmul__(self,*args):
"""
__rmul__(vector1: Vector,vector2: Vector) -> float
Calculates the dot product of the two specified vector structures and returns
the result as a System.Double.
vector1: The first vector to multiply.
vector2: The second vector to multiply.
Returns: Returns a System.Double containing the scalar dot product of vector1 and
vector2,which is calculated using the following formula:vector1.X * vector2.X
+ vector1.Y * vector2.Y
__rmul__(scalar: float,vector: Vector) -> Vector
Multiplies the specified scalar by the specified vector and returns the
resulting vector.
scalar: The scalar to multiply.
vector: The vector to multiply.
Returns: The result of multiplying scalar and vector.
"""
pass
def __rsub__(self,*args):
"""
__rsub__(vector1: Vector,vector2: Vector) -> Vector
Subtracts one specified vector from another.
vector1: The vector from which vector2 is subtracted.
vector2: The vector to subtract from vector1.
Returns: The difference between vector1 and vector2.
"""
pass
def __sub__(self,*args):
""" x.__sub__(y) <==> x-y """
pass
Length=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the length of this vector.
Get: Length(self: Vector) -> float
"""
LengthSquared=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the square of the length of this vector.
Get: LengthSquared(self: Vector) -> float
"""
X=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the System.Windows.Vector.X component of this vector.
Get: X(self: Vector) -> float
Set: X(self: Vector)=value
"""
Y=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the System.Windows.Vector.Y component of this vector.
Get: Y(self: Vector) -> float
Set: Y(self: Vector)=value
"""
| 30.612426 | 215 | 0.667053 |
0148eac89948dbf7e99bb94cb77565537c9937b2 | 6,869 | py | Python | binary_eight_queens_enhanced_num.py | MiniMarvin/oito-rainhas | 67be60d798a99ac218b2bbc53eabf47a563dce7b | [
"MIT"
] | null | null | null | binary_eight_queens_enhanced_num.py | MiniMarvin/oito-rainhas | 67be60d798a99ac218b2bbc53eabf47a563dce7b | [
"MIT"
] | null | null | null | binary_eight_queens_enhanced_num.py | MiniMarvin/oito-rainhas | 67be60d798a99ac218b2bbc53eabf47a563dce7b | [
"MIT"
] | null | null | null | import random
import math
from collections import OrderedDict
| 32.709524 | 125 | 0.526569 |
014a513ce67d34f43fbb3d224139ad39fdd0d756 | 639 | py | Python | problems/07/solution_07.py | r1cc4rdo/daily_coding_problem | 6ac85309fad2f64231ac7ab94aa4158e18bdec40 | [
"Unlicense"
] | 158 | 2018-01-25T06:33:30.000Z | 2022-03-14T23:18:05.000Z | problems/07/solution_07.py | r1cc4rdo/daily_coding_problem | 6ac85309fad2f64231ac7ab94aa4158e18bdec40 | [
"Unlicense"
] | 9 | 2018-07-04T00:31:57.000Z | 2020-05-16T21:02:30.000Z | problems/07/solution_07.py | r1cc4rdo/daily_coding_problem | 6ac85309fad2f64231ac7ab94aa4158e18bdec40 | [
"Unlicense"
] | 50 | 2018-06-22T16:48:44.000Z | 2022-01-11T16:45:48.000Z | def coding_problem_07(s):
"""
Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded.
Examples:
>>> coding_problem_07('111') # possible interpretations: 'aaa', 'ka', 'ak'
3
>>> coding_problem_07('2626') # 'zz', 'zbf', 'bfz', 'bfbf'
4
"""
symbols = map(str, range(1, 27))
if not s:
return 1
matches = filter(lambda symbol: s.startswith(symbol), symbols)
encodings = [coding_problem_07(s[len(m):]) for m in matches]
return sum(encodings)
if __name__ == '__main__':
import doctest
doctest.testmod(verbose=True)
| 26.625 | 115 | 0.610329 |
014ad83f5b068ba0e043359ccb1ae8ec77fba56c | 1,201 | py | Python | lfs/manage/views/criteria.py | michael-hahn/django-lfs | 26c3471a8f8d88269c84f714f507b952dfdb6397 | [
"BSD-3-Clause"
] | 345 | 2015-01-03T19:19:27.000Z | 2022-03-20T11:00:50.000Z | lfs/manage/views/criteria.py | mxins/django-lfs | bf42ed80ce0e1ec96db6ab985adcc614ea79dfc8 | [
"BSD-3-Clause"
] | 73 | 2015-01-06T14:54:02.000Z | 2022-03-11T23:11:34.000Z | lfs/manage/views/criteria.py | mxins/django-lfs | bf42ed80ce0e1ec96db6ab985adcc614ea79dfc8 | [
"BSD-3-Clause"
] | 148 | 2015-01-07T16:30:08.000Z | 2022-03-25T21:20:58.000Z | # django imports
from django.conf import settings
from django.contrib.auth.decorators import permission_required
from django.http import HttpResponse
# lfs imports
from lfs.core.utils import import_symbol
| 27.295455 | 77 | 0.717735 |
014b1316bbc807d3a6c4e323a2ddb1f35250a147 | 428 | py | Python | components/studio/apps/migrations/0055_appinstance_access.py | aitmlouk/stackn | c8029394a15b03796a4864938f9db251b65c7354 | [
"Apache-2.0"
] | 25 | 2020-05-08T22:24:54.000Z | 2022-03-11T18:16:58.000Z | components/studio/apps/migrations/0055_appinstance_access.py | aitmlouk/stackn | c8029394a15b03796a4864938f9db251b65c7354 | [
"Apache-2.0"
] | 75 | 2020-05-08T22:15:59.000Z | 2021-11-22T10:00:04.000Z | components/studio/apps/migrations/0055_appinstance_access.py | aitmlouk/stackn | c8029394a15b03796a4864938f9db251b65c7354 | [
"Apache-2.0"
] | 12 | 2020-11-04T13:09:46.000Z | 2022-03-14T16:22:40.000Z | # Generated by Django 3.1.7 on 2021-05-26 12:56
from django.db import migrations, models
| 22.526316 | 92 | 0.61215 |
014c661b4ee9f1765fe9a71fd14a56e7f1881ebd | 1,512 | py | Python | modulo-3/aulas/funcao_2.py | Luis-Felipe-N/curso-em-video-python | 09ff58ae31ae0360ebec74de609011d527956065 | [
"MIT"
] | null | null | null | modulo-3/aulas/funcao_2.py | Luis-Felipe-N/curso-em-video-python | 09ff58ae31ae0360ebec74de609011d527956065 | [
"MIT"
] | null | null | null | modulo-3/aulas/funcao_2.py | Luis-Felipe-N/curso-em-video-python | 09ff58ae31ae0360ebec74de609011d527956065 | [
"MIT"
] | null | null | null | # COMO TRABALHAMOS MUITO COM ROTINAS, CRIAR UMA FUNO E CHAMA-LA NO CDIGO FACILITA MUITO NO TER QUE ESCREVER A MESMA LINHA VRIAS VEZES
# USAMOS O COMANDO DEF PARA DECLARAR UMA FUNCAO, DEPOIS UM NOME PARA A FUNO EX:
# def nomeDaFuncao():
# # BLOCO COM O CDIGO QUE DESEJA QUE SEJ EXECULTADO NA CHAMADA DA FUNO
# print('Funcionando')
# nomeDaFuncao()# O RESULTADO FUI ("Funcionando")
# SEMPRE QUE PRESCISAMOS MOSTRAR UMA LINHA ESCREVEMOS TODA VEZ O MESMO CDIGO
# PARA FACILITAR PODEMOS CRIAR UMA FUNO QUE MOSTRE ESSA LINHA SEM PRESCISAR ESCREVER O CDIGO PRINT VRIAS VEZES
caixa('#', 'Python')# O RESULTADO
'''
############
Python
############'''
# MAS PODE VARIAER DE ACORDO COM O TEXTO SOLICITADO
soma(1, 4)# RESULTADO 5
soma(b=3, a=1)# RESULTADO 4, RECLARAMOS QUE O B=3 E A=1
contador(1, 5, 7, 7)
valores = [1, 2, 9, 7, 4]
print(valores)
dobrar(valores)
print(valores)
| 22.909091 | 138 | 0.671958 |
014ca2e3d1790bdd33dbe16cd9e24261132907eb | 5,160 | py | Python | ph5/utilities/tests/test_seg2toph5.py | iris-edu-int/PH5 | 2056191ec3db1dbcbbd18facba56750d3c5cc5b4 | [
"MIT"
] | 21 | 2016-12-07T20:09:31.000Z | 2022-03-07T22:23:57.000Z | ph5/utilities/tests/test_seg2toph5.py | iris-edu-int/PH5 | 2056191ec3db1dbcbbd18facba56750d3c5cc5b4 | [
"MIT"
] | 395 | 2016-11-03T03:43:55.000Z | 2022-03-08T20:54:22.000Z | ph5/utilities/tests/test_seg2toph5.py | iris-edu-int/PH5 | 2056191ec3db1dbcbbd18facba56750d3c5cc5b4 | [
"MIT"
] | 6 | 2016-10-25T22:22:38.000Z | 2021-05-10T18:19:45.000Z | '''
Tests for seg2toph5
'''
import os
import sys
import unittest
import logging
from mock import patch
from testfixtures import OutputCapture, LogCapture
from ph5.utilities import seg2toph5, initialize_ph5
from ph5.core.tests.test_base import LogTestCase, TempDirTestCase,\
initialize_ex
from ph5.core import ph5api
if __name__ == "__main__":
unittest.main()
| 43 | 77 | 0.605426 |
014d029371edfc926a3b46e79008ce4486f7ec74 | 29 | py | Python | pydreamer/models/__init__.py | rogerscristo/pydreamer | e44fdf8b35fe48662ed619100fdd5d9d6858f6db | [
"MIT"
] | 75 | 2021-10-12T13:17:48.000Z | 2022-03-04T14:43:30.000Z | pydreamer/models/__init__.py | LvZut/pydreamer | e3a522e13319d3667b526abb5f5747ab68e3c04e | [
"MIT"
] | 2 | 2022-01-17T06:49:50.000Z | 2022-02-17T19:45:24.000Z | pydreamer/models/__init__.py | LvZut/pydreamer | e3a522e13319d3667b526abb5f5747ab68e3c04e | [
"MIT"
] | 10 | 2021-11-27T18:20:26.000Z | 2022-03-14T09:06:52.000Z | from .dreamer import Dreamer
| 14.5 | 28 | 0.827586 |
014d7f5347c2db899cb4f07a82d8e90ce6a5c1f4 | 1,251 | py | Python | zcash/test_node.py | gwynethallwright/cs291d_project | 7d9bbb32acec855e777b93b88153869393d458d3 | [
"Apache-2.0"
] | null | null | null | zcash/test_node.py | gwynethallwright/cs291d_project | 7d9bbb32acec855e777b93b88153869393d458d3 | [
"Apache-2.0"
] | null | null | null | zcash/test_node.py | gwynethallwright/cs291d_project | 7d9bbb32acec855e777b93b88153869393d458d3 | [
"Apache-2.0"
] | null | null | null | import time
from zcash.node import *
node1 = Node(8002, "node 1")
node1.start()
# wait for string
time.sleep(2)
node1.print_blockchain()
time.sleep(2)
node2 = Node(8003, "node 2")
node2.start()
# wait for string
time.sleep(2)
node2.print_blockchain()
node1.get_balance()
node2.get_balance()
# node1 mint and pour to send to node2
tx1 = node1.mint_coin(1)
node1.broadcast_new_transaction(tx1)
# waiting for tx broadcast
time.sleep(2)
node1.show_coin()
tx2 = node1.mint_coin(1)
node1.broadcast_new_transaction(tx2)
# waiting for tx broadcast
time.sleep(2)
node1.show_coin()
coin_old_1 = list(node1.coin_set)[0]
coin_old_2 = list(node1.coin_set)[1]
tx3 = node1.pour_coin(coin_old_1, coin_old_2, node1.addr_sk, node1.addr_sk, 1, 1, node2.addr_pk, node2.addr_pk, 0, "")
sn_list = [tx3.tx_pour[1], tx3.tx_pour[2]]
# tx = Transaction(sender=node1.wallet.address, receiver=node2.wallet.address, amount=0.3)
# sig = node1.wallet.sign(str(tx))
# tx.set_sign(node1.wallet.pubkey, sig)
node1.broadcast_new_transaction(tx3)
# waiting for tx broadcast
time.sleep(2)
node1.show_coin()
node2.show_coin()
node2.receive_coin(node2.addr_pk, node2.addr_sk)
node2.print_blockchain()
node2.get_balance()
node1.get_balance()
node1.print_blockchain()
| 18.397059 | 118 | 0.751399 |
014e3e728d1d9378b4810966f0de08c19709bfa8 | 822 | py | Python | archived_lectures/Fall_2019/common_python/common_python/tests/tellurium/test_util.py | ModelEngineering/topics-course | cd0d73e4056663d170465669ecd699e8e74e35a0 | [
"MIT"
] | 2 | 2018-10-24T21:31:30.000Z | 2019-10-23T20:29:22.000Z | archived_lectures/Fall_2019/common_python/common_python/tests/tellurium/test_util.py | ModelEngineering/topics-course | cd0d73e4056663d170465669ecd699e8e74e35a0 | [
"MIT"
] | 1 | 2019-05-31T21:59:30.000Z | 2019-05-31T21:59:30.000Z | archived_lectures/Fall_2019/common_python/common_python/tests/tellurium/test_util.py | ModelEngineering/topics-course | cd0d73e4056663d170465669ecd699e8e74e35a0 | [
"MIT"
] | 9 | 2018-10-31T20:48:42.000Z | 2019-11-20T21:47:43.000Z | from common_python.tellurium import util
import pandas as pd
import numpy as np
import unittest
if __name__ == '__main__':
unittest.main()
| 25.6875 | 60 | 0.656934 |
014f313e34df031bf86f179460a6096cdeb0e1a1 | 535 | py | Python | hr_timesheet_invoice_release/account_invoice.py | sunflowerit/odoo-modules | 77e11c4868c3f94c031542b48e5d83797cf4a28d | [
"MIT"
] | null | null | null | hr_timesheet_invoice_release/account_invoice.py | sunflowerit/odoo-modules | 77e11c4868c3f94c031542b48e5d83797cf4a28d | [
"MIT"
] | 4 | 2016-10-19T17:01:04.000Z | 2018-01-12T18:34:58.000Z | hr_timesheet_invoice_release/account_invoice.py | sunflowerit/odoo-modules | 77e11c4868c3f94c031542b48e5d83797cf4a28d | [
"MIT"
] | 1 | 2018-03-08T16:23:52.000Z | 2018-03-08T16:23:52.000Z | # -*- coding: utf-8 -*-
# 2017 Sunflower IT (http://sunflowerweb.nl)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models, api, _
from openerp.exceptions import Warning
| 29.722222 | 72 | 0.665421 |
01507b0361d9bced76109c780b90eccee027d206 | 4,205 | py | Python | blocklenium/selenium_worker.py | jpunkt/blocklenium | dbe81b900d9c9781443d2cac2920815cb5f0a779 | [
"MIT"
] | null | null | null | blocklenium/selenium_worker.py | jpunkt/blocklenium | dbe81b900d9c9781443d2cac2920815cb5f0a779 | [
"MIT"
] | 1 | 2020-07-17T10:11:42.000Z | 2020-07-17T14:44:59.000Z | blocklenium/selenium_worker.py | jpunkt/blocklenium | dbe81b900d9c9781443d2cac2920815cb5f0a779 | [
"MIT"
] | null | null | null | import configparser
import logging
import threading
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
logger = logging.getLogger(__name__)
| 36.885965 | 75 | 0.572889 |
0150a51530726ef3c2430cedd19b6ce0d322142d | 1,595 | py | Python | setup.py | LaudateCorpus1/evohome-async | 333223df05b7881d6d9b831eb41d209846dd9a98 | [
"Apache-2.0"
] | 2 | 2020-11-18T14:33:49.000Z | 2021-12-27T14:52:54.000Z | setup.py | LaudateCorpus1/evohome-async | 333223df05b7881d6d9b831eb41d209846dd9a98 | [
"Apache-2.0"
] | 4 | 2021-03-10T16:54:31.000Z | 2022-01-21T10:16:33.000Z | setup.py | LaudateCorpus1/evohome-async | 333223df05b7881d6d9b831eb41d209846dd9a98 | [
"Apache-2.0"
] | 9 | 2020-12-06T08:07:45.000Z | 2022-02-08T07:03:53.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""The setup.py file."""
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.install import install
VERSION = "0.3.15"
URL = "https://github.com/zxdavb/evohome-async"
with open("README.md", "r") as fh:
LONG_DESCRIPTION = fh.read()
setup(
name="evohome-async",
description="An async client for connecting to Honeywell's TCC RESTful API.",
keywords=["evohome", "total connect comfort", "round thermostat"],
author="Andrew Stock & David Bonnes",
author_email="zxdavb@gmail.com",
url=URL,
download_url=f"{URL}/archive/{VERSION}.tar.gz",
install_requires=[val.strip() for val in open("requirements.txt")],
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
packages=find_packages(exclude=["test", "docs"]),
version=VERSION,
license="Apache 2",
python_requires=">=3.7",
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Topic :: Home Automation",
],
cmdclass={
"verify": VerifyVersionCommand,
},
)
| 28.482143 | 86 | 0.648276 |
0153baca680ffab8056f0a843270c4080b86ff69 | 74,403 | py | Python | tests/test_model_factory.py | TForce1/pcg_gazebo | 9ff88016b7b6903236484958ca7c6ed9f8ffb346 | [
"ECL-2.0",
"Apache-2.0"
] | 40 | 2020-02-04T18:16:49.000Z | 2022-02-22T11:36:34.000Z | tests/test_model_factory.py | awesomebytes/pcg_gazebo | 4f335dd460ef7c771f1df78b46a92fad4a62cedc | [
"ECL-2.0",
"Apache-2.0"
] | 75 | 2020-01-23T13:40:50.000Z | 2022-02-09T07:26:01.000Z | tests/test_model_factory.py | GimpelZhang/gazebo_world_generator | eb7215499d0ddc972d804c988fadab1969579b1b | [
"ECL-2.0",
"Apache-2.0"
] | 18 | 2020-09-10T06:35:41.000Z | 2022-02-20T19:08:17.000Z | #!/usr/bin/env python
# Copyright (c) 2019 - The Procedural Generation for Gazebo authors
# For information on the respective copyright owner see the NOTICE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
import numpy as np
import os
import shutil
from pcg_gazebo import random
from pcg_gazebo.utils import generate_random_string
from pcg_gazebo.generators.creators import create_models_from_config, extrude
from pcg_gazebo.simulation.properties import Material, Pose
from pcg_gazebo.simulation import SimulationModel
from pcg_gazebo.path import Path
from shapely.geometry import Polygon, MultiPoint, LineString
if __name__ == '__main__':
unittest.main()
| 41.705717 | 79 | 0.51342 |
015472fb9c391cf927e9fc40a91f9c791db806b8 | 3,646 | py | Python | scripts/server2ros.py | wjvanderlip/radbot_nuke | 7ea4bf049f4249ddbe033bd6453d80a4d6a604e2 | [
"MIT"
] | null | null | null | scripts/server2ros.py | wjvanderlip/radbot_nuke | 7ea4bf049f4249ddbe033bd6453d80a4d6a604e2 | [
"MIT"
] | null | null | null | scripts/server2ros.py | wjvanderlip/radbot_nuke | 7ea4bf049f4249ddbe033bd6453d80a4d6a604e2 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import rospy
import numpy as np
import pickle
import time
import socket
from rospy.numpy_msg import numpy_msg
from radbot_nuke.msg import detector_msg
rospy.init_node('detServer', anonymous=False)
pub = rospy.Publisher('/detector_data', detector_msg, queue_size=10)
def send_ros_msg(ts, adc, det_sn):
'''
takes output from client, packages it, and publishes as message
'''
msg = detector_msg()
now = time.time()
rnow = rospy.Time.now()
msg.header.stamp = rnow
msg.det_sn.data = det_sn
msg.detid = assign_det_num(det_sn)
msg.ts_sys = now
msg.ts_det = ts
msg.channel = adc
msg.event_rate = len(adc)*1.0
#process rate data if needed
pub.publish(msg)
print len(ts), len(adc), det_sn, " Published!!"
def process_rates(rates):
'''
If we start to hit the list mode buffer throughput, this parses
the "rate data" flag returned with each eMorpho buffer readout. Using the
live and dead time values you can assess higher count rate envs
https://www.bridgeportinstruments.com/products/mds/mds_doc/read_rates.php
'''
# old_acq_tme = 0
# old_ded_tme = 0
# old_dt = 0
# old_trig = 0
# old_event = 0
if rates[3] <= 0: #prevents dt frac from going to inf
rates[3] = 1
acq_tme = (rates[0] - old_acq_tme)
ded_tme = (rates[3] - old_ded_tme)
events = rates[1] - old_event
trigs = rates[2] - old_trig
active_time = (acq_tme * np.divide(65536, 80000000, dtype=np.float64)) # 16bit encoding, 80MHz, must use np.divide to return float64
msg.event_rate = events/active_time #event rate in seconds
msg.trig_rate = trigs/active_time #trigger rate in seconds
msg.true_rate = np.divide(trigs, active_time, dtype=np.float64) *(1 - np.divide(ded_tme, acq_tme, dtype=np.float64)) #true incident pulse rate i n seconds
old_acq_tme = rates[0]
old_ded_tme = rates[3]
old_event = rates[1]
old_trig = rates[2]
def start_server(port):
'''
Starts a server to constantly monior on some port for incoming data from one of the
multiprocessing subprocesses. The clinet will send a pickeled list consiting of the detectors
serial number, an array of event time stamps and an array of event ACD (channel) values
This data is then published on the /detector_data topic using the detector_msg message
'''
try:
serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
serv.bind(('0.0.0.0', port))
serv.listen(5)
buf = None
print "Waiting to receive connection..."
while True:
conn, addr = serv.accept()
while True:
data = conn.recv(4096)
if buf is None:
buf = data
else:
buf+=data
if '<-o->' in buf:
message = buf[:-len('<-o->')]
# PROCESS MESSAGE HERE
incoming_data = pickle.loads(message)
# print incoming_data[0], len(incoming_data[1]), len(incoming_data[2])
send_ros_msg(incoming_data[1], incoming_data[2], incoming_data[0]) #ts, acd, sn
buf = None
conn.close()
break
# print 'client disconnected'
except socket.error, exc:
print "Caught exception socket.error : %s" % exc
if __name__ == '__main__':
main()
| 33.145455 | 159 | 0.626166 |
01584c384f8f8eea463542d1db5fde7c51f316cc | 3,166 | py | Python | yubin/__init__.py | mritu301/NLP-Labeling | 403b06c25984646be9ed8f37c5777d32acc3dec1 | [
"MIT"
] | 3 | 2019-10-28T00:07:25.000Z | 2020-01-17T05:25:08.000Z | yubin/__init__.py | alvations/yubin | 403b06c25984646be9ed8f37c5777d32acc3dec1 | [
"MIT"
] | null | null | null | yubin/__init__.py | alvations/yubin | 403b06c25984646be9ed8f37c5777d32acc3dec1 | [
"MIT"
] | null | null | null | import re
from itertools import chain
from collections import defaultdict, namedtuple
import pandas as pd
from tqdm import tqdm
Address = namedtuple('Address', ['to', 'kai', 'ku', 'mune', 'chome', 'ban',
'go', 'postal', 'endgo', 'tokens'])
| 40.075949 | 93 | 0.549905 |
015973c0cde41c6d39371ea08957e73b3b7deff2 | 476 | py | Python | setup.py | vmraid/vitalpbx | 3debc302763e53393ccb9610cb117a7d4872d59a | [
"MIT"
] | null | null | null | setup.py | vmraid/vitalpbx | 3debc302763e53393ccb9610cb117a7d4872d59a | [
"MIT"
] | null | null | null | setup.py | vmraid/vitalpbx | 3debc302763e53393ccb9610cb117a7d4872d59a | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in vitalpbx/__init__.py
from vitalpbx import __version__ as version
setup(
name='vitalpbx',
version=version,
description='Something',
author='Someone',
author_email='someone@somewhere.com',
packages=find_packages(),
zip_safe=False,
include_package_data=True,
install_requires=install_requires
)
| 23.8 | 63 | 0.781513 |
015a6e13245e57ce78b8a86522e4aae0bd1d03bc | 381 | py | Python | 1030.py | heltonricardo/URI | 160cca22d94aa667177c9ebf2a1c9864c5e55b41 | [
"MIT"
] | 6 | 2021-04-13T00:33:43.000Z | 2022-02-10T10:23:59.000Z | 1030.py | heltonricardo/URI | 160cca22d94aa667177c9ebf2a1c9864c5e55b41 | [
"MIT"
] | null | null | null | 1030.py | heltonricardo/URI | 160cca22d94aa667177c9ebf2a1c9864c5e55b41 | [
"MIT"
] | 3 | 2021-03-23T18:42:24.000Z | 2022-02-10T10:24:07.000Z | for g in range(int(input())):
n, k = [int(x) for x in input().split()]
v = [1 for x in range(1, n+1)]
m = 0
i = p = 1
while (m < n-1):
if v[i] == 1: p += 1
if p == k:
v[i] = 0
m += 1
p = 0
i += 1
if i == n: i = 0
i = 0
while v[i] == 0: i += 1
print('Case {}: {}'.format(g+1, i+1))
| 22.411765 | 44 | 0.333333 |
015a892c046052f40a511917cfd969000101e5c9 | 8,215 | py | Python | onionstudio.py | jarret/onionstudio | 5ebf0a75cf1e7960822c96a987668be5ed82aa41 | [
"MIT"
] | 11 | 2020-01-09T19:48:20.000Z | 2020-11-21T19:59:36.000Z | onionstudio.py | jarret/onionstudio | 5ebf0a75cf1e7960822c96a987668be5ed82aa41 | [
"MIT"
] | null | null | null | onionstudio.py | jarret/onionstudio | 5ebf0a75cf1e7960822c96a987668be5ed82aa41 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) 2020 Jarret Dyrbye
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php
import time
import sys
import json
import argparse
from twisted.internet import reactor
from twisted.internet.task import LoopingCall
from autobahn.twisted.websocket import WebSocketServerProtocol
from autobahn.twisted.websocket import WebSocketServerFactory
from txzmq import ZmqEndpoint, ZmqEndpointType
from txzmq import ZmqFactory
from txzmq import ZmqSubConnection
from bolt.util import h2b
from onionstudio.art_db import ArtDb
from onionstudio.compressor import compressor
from onionstudio.extension import Extension, PIXEL_TLV_TYPE
UNPAID_PRUNE_CHECK = 60
UNPAID_PRUNE_SECONDS = 120
###############################################################################
###############################################################################
###############################################################################
HTLC_ACCEPTED_TAG = "htlc_accepted".encode("utf8")
FORWARD_EVENT_TAG = "forward_event".encode("utf8")
###############################################################################
DEFAULT_WEBSOCKET_PORT = 9000
DEFAULT_ZMQ_SUBSCRIBE_ENDPOINT = "tcp://127.0.0.1:6666"
DEFAULT_MOCK_ZMQ_SUBSCRIBE_ENDPOINT = "tcp://127.0.0.1:5557"
DEFAULT_ART_DB_DIR = "/tmp/onionstudio/"
parser = argparse.ArgumentParser(prog="onionstudio.py")
parser.add_argument("-e", "--endpoint", type=str,
default=DEFAULT_ZMQ_SUBSCRIBE_ENDPOINT,
help="endpoint to subscribe to for zmq notifications from "
"c-lightning via cl-zmq.py plugin")
parser.add_argument("-m", "--mock-endpoint", type=str,
default=DEFAULT_MOCK_ZMQ_SUBSCRIBE_ENDPOINT,
help="endpoint to subscribe to zmq notifcations from a "
"test script such as mock-png.py")
parser.add_argument("-w", "--websocket-port", type=int,
default=DEFAULT_WEBSOCKET_PORT,
help="port to listen for incoming websocket connections")
parser.add_argument("-a", "--art-db-dir", type=str, default=DEFAULT_ART_DB_DIR,
help="directory to save the image state and logs")
settings = parser.parse_args()
a = App(settings.endpoint, settings.mock_endpoint, settings.websocket_port,
settings.art_db_dir)
a.run()
reactor.addSystemEventTrigger("before", "shutdown", a.stop)
reactor.run()
| 37.340909 | 79 | 0.597687 |
015a901776e9ca3956396eb5890b4a755eb6a932 | 4,078 | py | Python | mavsim_holodeck/rosflight_holodeck.py | sethmnielsen/mavsim_template_files | 453ec4f7d38fc2d1162198b554834b5bdb7de96f | [
"MIT"
] | null | null | null | mavsim_holodeck/rosflight_holodeck.py | sethmnielsen/mavsim_template_files | 453ec4f7d38fc2d1162198b554834b5bdb7de96f | [
"MIT"
] | null | null | null | mavsim_holodeck/rosflight_holodeck.py | sethmnielsen/mavsim_template_files | 453ec4f7d38fc2d1162198b554834b5bdb7de96f | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
from __future__ import print_function
from rosflight_holodeck_interface import ROSflightHolodeck
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import time
import holodeck
from holodeck import agents
from holodeck.environments import *
from holodeck import sensors
from IPython.core.debugger import Pdb
import os
import cv2
print( '\nHOLODECK PATH: {}\n'.format( os.path.dirname( holodeck.__file__ ) ) )
np.set_printoptions(precision=3, suppress=True, sign=' ', floatmode='fixed')
if __name__ == '__main__':
env = holodeck.make("Ocean")
RF = ROSflightHolodeck()
env.reset()
env.tick()
# wave intensity: 1-13(int), wave size: 1-8(int), wave direction: 0-360 degreese (float)
env.set_ocean_state(3, 3, 90)
env.set_aruco_code(False)
x0 = np.array([0, 0, 0, # position [0-2]
1, 0, 0, 0, # attitude [3-6]
0, 0, 0, # velocity [7-9]
0, 0, 0, # omega [10-12]
0, 0, 0], dtype=np.float64) # acc [13-15]
h0 = 41 # initial altitude [m]
x0[2] = -h0
# x0[0] = -34.5
RF.init()
RF.setState(x0)
RF.setTime(10)
uav_cmd = np.array([0, 0, 0, 0])
boat_cmd = 0
env.act("uav0", uav_cmd)
env.act("boat0", boat_cmd)
pos0 = x0[:3] * [100, 100, -100] # convert to cm, negate z
env.teleport("uav0", location=pos0, rotation=[0,0,0])
env.teleport("boat0", location=[-2000,0,0], rotation=[0,0,0])
frate = 30 # frame rate of camera/rendering [Hz]
simrate = 800 # rate of simulated dynamics [Hz]
n = simrate//frate # Number of sim iterations between frames
dt = 1.0/simrate
#'F' order because eigen matrices are column-major while numpy are row-major
# x_arr = np.zeros((16, n), order='F')
x = np.zeros(16)
t = np.zeros(n)
rf_outputs = np.zeros(4)
state = np.array([])
pos = np.zeros(3)
att = np.zeros(3)
ground = -0.1
collision = False
count = 0
while 1: # Main loop: 1 iteration = 1 rendered frame
if not collision:
for i in range(n): # Loop between frames (dynamics/control)
RF.run(dt)
time.sleep(dt)
RF.getState(x)
# Make sure mav doesn't fall through ground
if x[2] > ground and x[9] > 0:
# at ground level and not gaining altitude
x_ground = np.copy(x0)
x_ground[:3] = [x[0], x[1], ground]
att_eul = Quaternion2Euler(x[3:7])
ground_eul = np.array([0, 0, att_eul[2]])
x_ground[3:7] = Euler2Quaternion(ground_eul)
pos = x_ground[:3] * [100,100,-100]
att = ground_eul * 180/np.pi
RF.setState(x_ground)
state = env.set_state("uav0", pos, att, [0,0,0], [0,0,0])["uav0"]
else:
# format state for holodeck
pos = x[:3] * [100,100,-100] # cm, negate z to convert to LH frame
att = Quaternion2Euler(x[3:7]) * 180/np.pi
vel = x[7:10] * [100,100,-100]
angvel = np.copy(x[10:13])
state = env.set_state("uav0", pos, att, vel, angvel)["uav0"]
collision = state['CollisionSensor']
elif collision:
# Use position given by holodeck
state = env.tick()["uav0"]
x = np.copy(x0)
x[:3] = state['LocationSensor'] * [1,1,-1]
x[7:10] = state['VelocitySensor'] * [1,1,-1]
RF.setState(x)
for k in range(10):
RF.run(dt)
time.sleep(dt*(n/10))
RF.getState(x)
RF.getOutputs(rf_outputs)
if x[9] < 0:
# gaining altitude, switch back to RF dynamics
collision = False
# Show UAV's camera feed
# frame = state['RGBCamera']
# cv2.imshow('Camera', frame)
# cv2.waitKey(1)
# For debugging
RF.getState(x) | 34.268908 | 92 | 0.540216 |
015b648e126b7003dc4ab0b7712ea0d4e285061d | 6,762 | py | Python | projects/Graphing_and_DataEntry/graphing_calculator.py | DavidsonNext/WWW | cf486e641e19d0b8c3823cceafc5389f0b3d6bb7 | [
"Apache-2.0"
] | null | null | null | projects/Graphing_and_DataEntry/graphing_calculator.py | DavidsonNext/WWW | cf486e641e19d0b8c3823cceafc5389f0b3d6bb7 | [
"Apache-2.0"
] | null | null | null | projects/Graphing_and_DataEntry/graphing_calculator.py | DavidsonNext/WWW | cf486e641e19d0b8c3823cceafc5389f0b3d6bb7 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from IPython.display import HTML
# <markdowncell>
# #Graphing Calculator - inspired by AP Calculus
# Graphing calculators are permitted for use during "calculator active" problems on AP exams. Here we attempt to provide open access to those functionalities required for the AP exam.
#
# https://apstudent.collegeboard.org/apcourse/ap-calculus-ab/calculator-policy
#
# * Plot the graph of a function within an arbitrary viewing window
# * Find the zeros of functions (solve equations numerically)
# * Numerically calculate the derivative of a function
# * Numerically calculate the value of a definite integral
# <codecell>
%%HTML
<!DOCTYPE html>
<html>
<head>
<style>
</style>
</head>
<body>
<div id="menu" style="width: 270px; float: left;">
<ul>
<input class="txtbox" type="text" id="inputF" placeholder="Type a function f(x)" value="x^3+x^2-6*x" font-size: "10px">
<input class="btn" type="button" value="Plot" onClick="plotter()">
<!--
<input class="btn" type="button" value="add tangent" onClick="addTangent()">
-->
<input class="btn" type="button" value="Add Derivative" onClick="plotDerivative()">
<input class="btn" type="button" value="Clear All" onClick="clearAll()">
</ul>
<br></br>
<ul>
<input class="txtbox" type="text" id="inputZstart" placeholder="Start value for zero search" font-size: "6">
<input class="btn" type="button" value="find Zero" onClick="findZeroes()">
</ul>
</div>
<div id='jxgbox' class='jxgbox' style='width:450px; height:350px; margin-left: 180px; border: solid #1f628d 1px;'></div>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.98/jsxgraphcore.js"></script>
<script type='text/javascript'>
var initBoundingBox = [-11,11,11,-11];
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:initBoundingBox, axis:true, showCopyright:false});
var f, curve; // global objects
function plotter() {
var txtraw = document.getElementById('inputF').value;
f = board.jc.snippet(txtraw, true, 'x', true);
curve = board.create('functiongraph',[f,
function(){
var c = new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],board);
return c.usrCoords[1];
},
function(){
var c = new JXG.Coords(JXG.COORDS_BY_SCREEN,[board.canvasWidth,0],board);
return c.usrCoords[1];
}
],
{name:txtraw, withLabel:false});
var q = board.create('glider', [2, 3, curve], {withLabel:false});
var t = board.create('text', [
function(){ return q.X()+0.2; },
function(){ return q.Y()+0.1; },
//function(){ return "The slope of the function f(x)=" + txtraw + "<br>at x=" + q.X().toFixed(2) + " is equal to " + (JXG.Math.Numerics.D(f))(q.X()).toFixed(2); }
//function(){ return "f(x)=" + txtraw + "<br>f(x=" + q.X().toFixed(2) + ") = " + f(q.X()).toFixed(2)}
function(){ return "f(x=" + q.X().toFixed(2) + ") = " + f(q.X()).toFixed(2)}
],
{fontSize:15});
}
function clearAll() {
JXG.JSXGraph.freeBoard(board);
board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:initBoundingBox, axis:true, showCopyright:false});
f = null;
curve = null;
}
function addTangent() {
if (JXG.isFunction(f)) {
board.suspendUpdate();
var p = board.create('glider',[1,0,curve], {name:'drag me'});
board.create('tangent',[p], {name:'drag me'});
board.unsuspendUpdate();
}
}
function plotDerivative() {
if (JXG.isFunction(f)) {
board.create('functiongraph',[JXG.Math.Numerics.D(f),
function(){
var c = new JXG.Coords(JXG.COORDS_BY_SCREEN,[0,0],board);
return c.usrCoords[1];
},
function(){
var c = new JXG.Coords(JXG.COORDS_BY_SCREEN,[board.canvasWidth,0],board);
return c.usrCoords[1];
}], {dash:2});
}
}
function isNumeric(num){
return !isNaN(num)
}
function findZeroes() {
var zeroraw = document.getElementById('inputZstart').value;
if (JXG.isFunction(f) && isNumeric(zeroraw)) {
board.suspendUpdate();
var zero = JXG.Math.Numerics.fzero(f,parseFloat(zeroraw));
var f_zero = f(zero);
var p = board.create('point',[zero,f_zero], {name:'f(x='+zero.toFixed(2)+')=0.0',
strokeColor:'gray', face:'<>',fixed:true});
//board.create('tangent',[p], {name:'drag me'});
board.unsuspendUpdate();
}
}
function findNumDerivative() {
var zeroraw = document.getElementById('inputNumDerivative').value;
if (JXG.isFunction(f) && isNumeric(zeroraw)) {
board.suspendUpdate();
var zero = JXG.Math.Numerics.fzero(f,parseFloat(zeroraw));
var f_zero = f(zero);
var p = board.create('point',[zero,f_zero], {name:'a zero of the function',
strokeColor:'gray', face:'<>'});
//board.create('tangent',[p], {name:'drag me'});
board.unsuspendUpdate();
}
}
</script>
</body>
</html>
# <markdowncell>
# ### No Grading setup at this time.
# <codecell>
# <codecell>
| 40.981818 | 184 | 0.484028 |
015c37dadd907a823b8a57e0e66db4c591cdd0d4 | 3,294 | py | Python | pyinsar/processing/discovery/coherence.py | MITeaps/pyinsar | 4d22e3ef90ef842d6b390074a8b5deedc7658a2b | [
"MIT"
] | 8 | 2019-03-15T19:51:27.000Z | 2022-02-16T07:27:36.000Z | pyinsar/processing/discovery/coherence.py | MITeaps/pyinsar | 4d22e3ef90ef842d6b390074a8b5deedc7658a2b | [
"MIT"
] | 1 | 2022-02-08T03:48:56.000Z | 2022-02-09T01:33:27.000Z | pyinsar/processing/discovery/coherence.py | MITeaps/pyinsar | 4d22e3ef90ef842d6b390074a8b5deedc7658a2b | [
"MIT"
] | 2 | 2021-01-12T05:32:21.000Z | 2021-01-13T08:35:26.000Z | # The MIT License (MIT)
# Copyright (c) 2017 Massachusetts Institute of Technology
#
# Authors: Cody Rude
# This software is part of the NSF DIBBS Project "An Infrastructure for
# Computer Aided Discovery in Geoscience" (PI: V. Pankratius) and
# NASA AIST Project "Computer-Aided Discovery of Earth Surface
# Deformation Phenomena" (PI: V. Pankratius)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Standard library imports
from collections import OrderedDict
# scikit discovery imports
from skdiscovery.data_structure.framework.base import PipelineItem
# Pyinsar imports
from pyinsar.processing.utilities.generic import coherence
# Scikit data access imports
from skdaccess.utilities.support import progress_bar
| 38.302326 | 104 | 0.697936 |
015dfc2575ba43d461c6f8e236abfb9df3bf731f | 997 | py | Python | conf.py | Kurento/doc-fiware | 053537edec34fff65e7044f0310ac8c539e011a7 | [
"Apache-2.0"
] | null | null | null | conf.py | Kurento/doc-fiware | 053537edec34fff65e7044f0310ac8c539e011a7 | [
"Apache-2.0"
] | 1 | 2018-11-22T12:48:37.000Z | 2018-11-22T12:48:37.000Z | conf.py | Kurento/doc-fiware | 053537edec34fff65e7044f0310ac8c539e011a7 | [
"Apache-2.0"
] | 3 | 2018-05-13T09:46:50.000Z | 2018-12-31T13:06:48.000Z | # -*- coding: utf-8 -*-
#
# on_rtd is whether we are on readthedocs.org
import os
import sys
sys.path.insert(0, os.path.abspath('.'))
sys.path.append(os.path.abspath('extensions'))
extensions = [
'sphinx.ext.graphviz',
'sphinx.ext.todo',
'wikipedia',
'examplecode'
]
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
html_theme_path = ['doc/themes']
html_theme = 'sphinx_rtd_theme'
# otherwise, readthedocs.org uses their theme by default, so no need to specify it
# Using downloaded sphinx_rtd_theme
# import sphinx_rtd_theme
# html_theme = "sphinx_rtd_theme"
# html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
project = 'FIWARE-Stream-Oriented-GE'
master_doc = 'index'
html_context = {
'css_files': [
'_static/css/theme.css',
'https://fiware.org/style/fiware_readthedocs.css',
'https://fiware.org/style/fiware_readthedocs_media_streams.css'
]
}
| 24.925 | 82 | 0.706118 |
015e1ccb959f266ccad863b921198255b5930975 | 2,372 | py | Python | Day21/dice.py | squidbot/aoc2021 | aae5cf2017562150ec01d6cce5200ebc2b02f19d | [
"MIT"
] | null | null | null | Day21/dice.py | squidbot/aoc2021 | aae5cf2017562150ec01d6cce5200ebc2b02f19d | [
"MIT"
] | null | null | null | Day21/dice.py | squidbot/aoc2021 | aae5cf2017562150ec01d6cce5200ebc2b02f19d | [
"MIT"
] | null | null | null | test_input = [4, 8]
puzzle_input = [4, 9]
#part1()
import collections
part2()
| 32.493151 | 124 | 0.544266 |
015f0c33210496779ba5007e68d3fe09693fe4a9 | 1,666 | py | Python | visualizeSIM.py | Jhko725/ProteinStructureReconstruction.jl | 18ec2f5a63e3c07d4498da363a8befc86e7ad68c | [
"MIT"
] | null | null | null | visualizeSIM.py | Jhko725/ProteinStructureReconstruction.jl | 18ec2f5a63e3c07d4498da363a8befc86e7ad68c | [
"MIT"
] | null | null | null | visualizeSIM.py | Jhko725/ProteinStructureReconstruction.jl | 18ec2f5a63e3c07d4498da363a8befc86e7ad68c | [
"MIT"
] | null | null | null | from typing import Optional
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.axis import Axis
from matplotlib.patches import Rectangle
from superresolution import SIM_3D_Data
# TODO: add support for plotting slices along x and y axes as well.
# Will need to use transpose to swap that dimension with zero and proceed with the rest of the logic
| 36.217391 | 124 | 0.696279 |
01628e3852b55e9865865ff86cdf3e6ad3323fe8 | 1,097 | py | Python | misc/disablepasscomplexity.py | brianfinley/confluent | 6458eac93b1e3c6d45e26a7ddb434d692b5cdff2 | [
"Apache-2.0"
] | 27 | 2015-02-11T13:56:46.000Z | 2021-12-28T14:17:20.000Z | misc/disablepasscomplexity.py | brianfinley/confluent | 6458eac93b1e3c6d45e26a7ddb434d692b5cdff2 | [
"Apache-2.0"
] | 32 | 2015-09-23T13:19:04.000Z | 2022-03-15T13:50:45.000Z | misc/disablepasscomplexity.py | brianfinley/confluent | 6458eac93b1e3c6d45e26a7ddb434d692b5cdff2 | [
"Apache-2.0"
] | 24 | 2015-07-14T20:41:55.000Z | 2021-07-15T04:18:51.000Z | #!/usr/bin/python2
import pyghmi.util.webclient as webclient
import json
import os
import sys
missingargs = False
if 'XCCUSER' not in os.environ:
print('Must set XCCUSER environment variable')
missingargs = True
if 'XCCPASS' not in os.environ:
print('Must set XCCPASS environment variable')
missingargs = True
if missingargs:
sys.exit(1)
w = webclient.SecureHTTPConnection(sys.argv[1], 443, verifycallback=lambda x: True)
w.connect()
adata = json.dumps({'username': os.environ['XCCUSER'], 'password': os.environ['XCCPASS']})
headers = {'Connection': 'keep-alive', 'Content-Type': 'application/json'}
w.request('POST', '/api/login', adata, headers)
rsp = w.getresponse()
if rsp.status == 200:
rspdata = json.loads(rsp.read())
w.set_header('Content-Type', 'application/json')
w.set_header('Authorization', 'Bearer ' + rspdata['access_token'])
if '_csrf_token' in w.cookies:
w.set_header('X-XSRF-TOKEN', w.cookies['_csrf_token'])
print(repr(w.grab_json_response('/api/dataset', {
'USER_GlobalPassComplexRequired': '0',
})))
| 33.242424 | 90 | 0.688241 |
0162a9072742aec24078e0ec6e07600eec4b5259 | 193 | py | Python | get_topics.py | FoamyGuy/CircuitPython_Repo_Topics | 9a606e9549bcd663d6290c0648466022c1b964db | [
"MIT"
] | null | null | null | get_topics.py | FoamyGuy/CircuitPython_Repo_Topics | 9a606e9549bcd663d6290c0648466022c1b964db | [
"MIT"
] | null | null | null | get_topics.py | FoamyGuy/CircuitPython_Repo_Topics | 9a606e9549bcd663d6290c0648466022c1b964db | [
"MIT"
] | null | null | null | from github import Github
from my_token import token
g = Github(token)
repo = g.get_repo("adafruit/Adafruit_CircuitPython_Display_Text")
repo_topics = repo.get_topics()
print(repo_topics)
| 16.083333 | 65 | 0.797927 |
0163e63b0f0a4b6a54cef6dce6ac42cdbc68fb82 | 1,200 | py | Python | tests/test_write_simple.py | ZELLMECHANIK-DRESDEN/fcswrite | 3b696a0fd4a34f7d3999d4e28bd7981fe38494d2 | [
"BSD-3-Clause"
] | 8 | 2018-03-15T00:04:47.000Z | 2021-11-15T09:32:18.000Z | tests/test_write_simple.py | ZELLMECHANIK-DRESDEN/fcswrite | 3b696a0fd4a34f7d3999d4e28bd7981fe38494d2 | [
"BSD-3-Clause"
] | 6 | 2017-05-03T10:19:55.000Z | 2021-11-17T01:57:56.000Z | tests/test_write_simple.py | ZELLMECHANIK-DRESDEN/fcswrite | 3b696a0fd4a34f7d3999d4e28bd7981fe38494d2 | [
"BSD-3-Clause"
] | 2 | 2018-06-28T19:18:01.000Z | 2018-11-05T15:20:04.000Z | import hashlib
import os
import tempfile
import numpy as np
import fcswrite
def test_write_fcs():
"""test that fcm can read the data files"""
fname = tempfile.mktemp(suffix=".fcs", prefix="write_test")
data = 1.0*np.arange(400).reshape((100, 4))
chn_names = ['cha', 'chb', 'ch3', 'ch4']
# monkey-patch fcswrite version to have reproducible result
oldver = fcswrite.__version__
fcswrite.fcswrite.version = "0.5.0"
fcswrite.write_fcs(filename=fname,
chn_names=chn_names,
data=data
)
# write back correct version
fcswrite.fcswrite.version = oldver
with open(fname, "rb") as fd:
data = fd.read()
data = np.frombuffer(data, dtype=np.uint8)
# remove empty lines
data = data[data != 8224]
data = data.tostring()
hasher = hashlib.md5()
hasher.update(data)
hexval = hasher.hexdigest()
assert hexval == "2b4fdb7012b0693285c31aa91c606216"
os.remove(fname)
if __name__ == "__main__":
# Run all tests
loc = locals()
for key in list(loc.keys()):
if key.startswith("test_") and hasattr(loc[key], "__call__"):
loc[key]()
| 27.906977 | 69 | 0.615833 |
0165ca0a608b2f11c5571565ecd2b89540a7f4ec | 1,810 | py | Python | adam_visual_perception/preprocessor.py | isi-vista/adam-visual-perception | 8ad6ed883b184b5407a1bf793617b226c78b3a13 | [
"MIT"
] | 1 | 2020-07-21T10:52:26.000Z | 2020-07-21T10:52:26.000Z | adam_visual_perception/preprocessor.py | isi-vista/adam-visual-perception | 8ad6ed883b184b5407a1bf793617b226c78b3a13 | [
"MIT"
] | null | null | null | adam_visual_perception/preprocessor.py | isi-vista/adam-visual-perception | 8ad6ed883b184b5407a1bf793617b226c78b3a13 | [
"MIT"
] | 2 | 2020-07-21T15:30:42.000Z | 2021-01-20T21:54:09.000Z | from moviepy.editor import VideoFileClip
from datetime import datetime
import numpy as np
import time
import os
def manage_time(timestamp):
"""
Given the string representation of a the time using the
"minutes:seconds[:miliseconds]" representation, returns the number
of seconds using double precision
"""
time_strip = timestamp.split(":")
seconds = int(time_strip[0]) * 60 + int(time_strip[1])
# Add miliseconds
if len(time_strip) == 3:
seconds += int(time_strip[2]) / 60
return seconds
def preprocess_video(filename, start, end, target_name, audio, codec=None):
"""
Preprocess an input video by cutting it given start time to end time,
optionally removing the audio and changing video encoding
"""
# Load the video file
clip = VideoFileClip(filename)
# Calculate start and end points in seconds
starting_point = manage_time(start)
end_point = manage_time(end)
# Resize the video and save the file
subclip = clip.subclip(starting_point, end_point)
subclip.write_videofile(target_name, audio=audio, codec=codec)
| 29.672131 | 83 | 0.654696 |
0165f80525bcd690617df14c805c36b82363c9f9 | 119 | py | Python | experiments/localization.py | seba-1511/cervix.kaggle | 5bf956a85481a961fb9af237aba2d2254cf6921a | [
"Apache-2.0"
] | null | null | null | experiments/localization.py | seba-1511/cervix.kaggle | 5bf956a85481a961fb9af237aba2d2254cf6921a | [
"Apache-2.0"
] | null | null | null | experiments/localization.py | seba-1511/cervix.kaggle | 5bf956a85481a961fb9af237aba2d2254cf6921a | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
| 19.833333 | 58 | 0.731092 |
0166496ddadc3242ff31aa5f6df7726900b884d0 | 505 | py | Python | test/demo-random.py | ruth-ann/snap-python | fe98de7b5697b3d60eb3497893e24801ae1916f9 | [
"BSD-3-Clause"
] | 242 | 2015-01-01T08:40:28.000Z | 2022-03-18T05:22:09.000Z | test/demo-random.py | ruth-ann/snap-python | fe98de7b5697b3d60eb3497893e24801ae1916f9 | [
"BSD-3-Clause"
] | 99 | 2015-01-24T07:55:27.000Z | 2021-10-30T18:20:13.000Z | test/demo-random.py | ruth-ann/snap-python | fe98de7b5697b3d60eb3497893e24801ae1916f9 | [
"BSD-3-Clause"
] | 105 | 2015-03-03T06:45:17.000Z | 2022-02-24T15:52:40.000Z | import snap
G = snap.GenFull(snap.PNEANet, 100)
# get a new random generator, provide the seed value
Rnd = snap.TRnd(42)
# randomize the generator, every execution will produce a different sequence.
# Comment out the line to get the same sequence on every execution.
Rnd.Randomize()
for i in range(0,10):
# provide the random generator as a parameter to the function
NId = G.GetRndNId(Rnd)
print(NId)
# result is not well formed, the following statement fails
#print(NI.GetId())
| 25.25 | 77 | 0.724752 |
01685654bd4a20e989dd7468c19a080303cdaf20 | 1,846 | py | Python | learn-python/basics/basicCommands.py | pradeep-charism/python-projects | 5933bbbc309e6e271701ac2643a657e0928e7090 | [
"MIT"
] | null | null | null | learn-python/basics/basicCommands.py | pradeep-charism/python-projects | 5933bbbc309e6e271701ac2643a657e0928e7090 | [
"MIT"
] | null | null | null | learn-python/basics/basicCommands.py | pradeep-charism/python-projects | 5933bbbc309e6e271701ac2643a657e0928e7090 | [
"MIT"
] | null | null | null | print("Thank you Jesus")
# Read a value from standard input a value
# input("Thank you")
# Evaluate expression
x = 1
print(x)
x += 3
print(x)
# loops
if x > 1:
print("great than 1")
else:
print("less than 1")
n = 3
while n > 1:
print(n)
n -= 1
# Arithmetic operator
print({100 % 3}, {100 / 3})
z = 1
print(z, type(z))
z = "dsf"
print(z, type(z))
print(17 // 3) # floor division discards the fractional part
print(5 ** 2) # 5 squared
# use raw strings by adding an r before the first quote
print(r'C:\some\name')
# String literals can span multiple lines. One way is using triple-quotes: """...""" or '''...'''
print("""\
dsfdsfds
ddsf
dfdf
dfdfds
""")
w = 'thanks'
print(w[:3] + w[3:])
# All slice operations return a new list containing the requested elements.
# This means that the following slice returns a new (shallow) copy of the list:
squares = [1, 4, 9, 16, 25]
for n in squares:
print(n, end='-')
if n == 16:
squares.insert(n, 100)
print('\n')
print(squares[:])
squares.append(10)
print(squares[:])
squares = []
print(squares[:])
# Fibonacci
a, b = 0, 1
while b < 25:
print(b)
a, b = b, a + b
# Fibonacci
a, b = 0, 1
while b < 1000:
print(b, end=',')
a, b = b, a + b
print('\n')
# Loops
for i in range(3, 15, 4):
print(i)
a = ['Mary', 'had', 'a', 'little', 'lamb']
for i in range(len(a)):
print(i, a[i])
print(list(range(5)))
print(f(1))
print(f(2))
print(f(3))
# if __name__ == "__main__":
# import sys
#
# print(int(sys.argv[1]))
import sys
print(dir(sys))
print('12'.zfill(5))
print('We are the {} who say "{}!"'.format('knights', 'Ni'))
print('{0} and {1}'.format('spam', 'eggs'))
# Formatting: https://docs.python.org/3.6/tutorial/inputoutput.html
quit(1)
| 15.644068 | 97 | 0.583965 |
0168c916329d1339e42f8c2b7773aa690c463962 | 3,562 | py | Python | smdebug/core/logger.py | jsspric/sagemaker-debugger | d7010869e19ae49c4f371935f27afcb585195f79 | [
"Apache-2.0"
] | 133 | 2019-12-03T18:56:27.000Z | 2022-03-18T19:54:49.000Z | smdebug/core/logger.py | jsspric/sagemaker-debugger | d7010869e19ae49c4f371935f27afcb585195f79 | [
"Apache-2.0"
] | 384 | 2019-12-04T03:04:14.000Z | 2022-03-31T20:42:48.000Z | smdebug/core/logger.py | jsspric/sagemaker-debugger | d7010869e19ae49c4f371935f27afcb585195f79 | [
"Apache-2.0"
] | 64 | 2019-12-05T20:39:51.000Z | 2022-03-25T13:30:54.000Z | # Standard Library
import logging
import os
import socket
import sys
from collections import defaultdict
# First Party
from smdebug.core.config_constants import LOG_DUPLICATION_THRESHOLD
_logger_initialized = False
def _get_log_level():
default = "info"
log_level = os.environ.get("SMDEBUG_LOG_LEVEL", default=default)
log_level = log_level.lower()
allowed_levels = ["info", "debug", "warning", "error", "critical", "off"]
if log_level not in allowed_levels:
log_level = default
level = None
if log_level is None or log_level == "off":
level = None
else:
if log_level == "critical":
level = logging.CRITICAL
elif log_level == "error":
level = logging.ERROR
elif log_level == "warning":
level = logging.WARNING
elif log_level == "info":
level = logging.INFO
elif log_level == "debug":
level = logging.DEBUG
return level
def get_logger(name="smdebug"):
global _logger_initialized
if not _logger_initialized:
worker_pid = f"{socket.gethostname()}:{os.getpid()}"
log_context = os.environ.get("SMDEBUG_LOG_CONTEXT", default=worker_pid)
level = _get_log_level()
logger = logging.getLogger(name)
logger.handlers = []
log_formatter = logging.Formatter(
fmt="[%(asctime)s.%(msecs)03d "
+ log_context
+ " %(levelname)s %(filename)s:%(lineno)d] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setFormatter(log_formatter)
if os.environ.get("SMDEBUG_LOG_ALL_TO_STDOUT", default="TRUE").lower() == "false":
stderr_handler = logging.StreamHandler(sys.stderr)
min_level = logging.DEBUG
# lets through all levels less than ERROR
stdout_handler.addFilter(MaxLevelFilter(logging.ERROR))
stdout_handler.setLevel(min_level)
stderr_handler.setLevel(max(min_level, logging.ERROR))
stderr_handler.setFormatter(log_formatter)
logger.addHandler(stderr_handler)
logger.addHandler(stdout_handler)
logger.addFilter(DuplicateLogFilter())
# SMDEBUG_LOG_PATH is the full path to log file
# by default, log is only written to stdout&stderr
# if this is set, it is written to file
path = os.environ.get("SMDEBUG_LOG_PATH", default=None)
if path is not None:
fh = logging.FileHandler(path)
fh.setFormatter(log_formatter)
logger.addHandler(fh)
if level:
logger.setLevel(level)
else:
logger.disabled = True
logger.propagate = False
_logger_initialized = True
return logging.getLogger(name)
| 31.803571 | 91 | 0.635598 |
0169e02b946dc8b1102bf51029d535f9fe1e7d2d | 15,883 | py | Python | build/lib/scrapper/settings.py | guilhermeKodama/Closetinn | 44d6792cfb0db9cce56db83f2e8c4b8777530f68 | [
"MIT"
] | null | null | null | build/lib/scrapper/settings.py | guilhermeKodama/Closetinn | 44d6792cfb0db9cce56db83f2e8c4b8777530f68 | [
"MIT"
] | null | null | null | build/lib/scrapper/settings.py | guilhermeKodama/Closetinn | 44d6792cfb0db9cce56db83f2e8c4b8777530f68 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Scrapy settings for scrapper project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
# http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
import os
# CATEGORY MAPPING SETTINGS
CATEGORY_MAPPING = {
"dafiti": {
"calcados femininos": ["Feminino", "Calados"],
"calcados masculinos": ["Masculino", "Calados"],
"calcados infantis": ["Infantil", "Calados"],
"esporte masculino": ["Masculino", "Esporte"],
"esporte feminino": ["Feminino", "Esporte"],
"roupas masculinas": ["Masculino", "Roupas"],
"roupas femininas": ["Feminino", "Roupas"],
"roupas infantis": ["Infantil", "Roupas"],
"bolsas e acessorios masculinos": ["Masculino", "Acessrios"],
"bolsas e acessorios femininos": ["Feminino", "Acessrios"],
"bolsas e acessorios infantis": ["Infantil", "Acessrios"]
},
"kanui": {
"feminino-acessorios": ["Feminino", "Acessrios"],
"feminino-agasalhos": ["Feminino", "Roupas"],
"feminino-alpargatas": ["Feminino", "Calados"],
"feminino-bermudas": ["Feminino", "Roupas"],
"feminino-bijouterias": ["Feminino", "Acessrios"],
"feminino-biquinis": ["Feminino", "Roupas"],
"feminino-blazers": ["Feminino", "Roupas"],
"feminino-blusas": ["Feminino", "Roupas"],
"feminino-bodys": ["Feminino", "Roupas"],
"feminino-bolsas": ["Feminino", "Acessrios"],
"feminino-bones": ["Feminino", "Acessrios"],
"feminino-botas": ["Feminino", "Calados"],
"feminino-cachecois": ["Feminino", "Acessrios"],
"feminino-calcados": ["Feminino", "Calados"],
"feminino-calcas": ["Feminino", "Roupas"],
"feminino-calcinha": ["Feminino", "Roupas"],
"feminino-camisas": ["Feminino", "Roupas"],
"feminino-camisetas": ["Feminino", "Roupas"],
"feminino-carteiras": ["Feminino", "Acessrios"],
"feminino-casacos": ["Feminino", "Roupas"],
"feminino-casuais": ["Feminino", "Roupas"],
"feminino-chinelos": ["Feminino", "Calados"],
"feminino-chuteiras": ["Feminino", "Esporte"],
"feminino-ciclismo": ["Feminino", "Esporte"],
"feminino-cintos": ["Feminino", "Acessrios"],
"feminino-coletes": ["Feminino", "Roupas"],
"feminino-cueca": ["Feminino", "Roupas"],
"feminino-docksides": ["Feminino", "Calados"],
"feminino-equipamentos": ["Feminino", "Esporte"],
"feminino-gorros": ["Feminino", "Acessrios"],
"feminino-jaquetas": ["Feminino", "Roupas"],
"feminino-jardineiras": ["Feminino", "Roupas"],
"feminino-kimonos": ["Feminino", "Esporte"],
"feminino-lencos": ["Feminino", "Roupas"],
"feminino-lingeries": ["Feminino", "Roupas"],
"feminino-luvas": ["Feminino", "Acessrios"],
"feminino-macacoes": ["Feminino", "Roupas"],
"feminino-macaquinhos": ["Feminino", "Roupas"],
"feminino-maios": ["Feminino", "Roupas"],
"feminino-meias": ["Feminino", "Roupas"],
"feminino-mocassins": ["Feminino", "Roupas"],
"feminino-moletons": ["Feminino", "Roupas"],
"feminino-oxfords": ["Feminino", "Calados"],
"feminino-polos": ["Feminino", "Roupas"],
"feminino-protetores": ["Feminino", "Esporte"],
"feminino-relogios": ["Feminino", "Acessrios"],
"feminino-roupas": ["Feminino", "Roupas"],
"feminino-saias": ["Feminino", "Roupas"],
"feminino-sapatenis": ["Feminino", "Calados"],
"feminino-sapatilhas": ["Feminino", "Calados"],
"feminino-shorts": ["Feminino", "Roupas"],
"feminino-slippers": ["Feminino", "Calados"],
"feminino-tenis": ["Feminino", "Calados"],
"feminino-tops": ["Feminino", "Roupas"],
"feminino-tricots": ["Feminino", "Roupas"],
"feminino-vestidos": ["Feminino", "Roupas"],
"feminino-viseiras": ["Feminino", "Esporte"],
"feminino-wetsuits": ["Feminino", "Esporte"],
"masculino-acessorios": ["Masculino", "Acessrios"],
"masculino-agasalhos": ["Masculino", "Roupas"],
"masculino-alpargatas": ["Masculino", "Calados"],
"masculino-bermuda": ["Masculino", "Roupas"],
"masculino-bermudas": ["Masculino", "Roupas"],
"masculino-bijouterias": ["Masculino", "Acessrios"],
"masculino-blusas": ["Masculino", "Roupas"],
"masculino-bolsas": ["Masculino", "Acessrios"],
"masculino-bones": ["Masculino", "Acessrios"],
"masculino-botas": ["Masculino", "Calados"],
"masculino-cachecois": ["Masculino", "Acessrios"],
"masculino-calcados": ["Masculino", "Calados"],
"masculino-calcas": ["Masculino", "Roupas"],
"masculino-camisas": ["Masculino", "Roupas"],
"masculino-camisetas": ["Masculino", "Roupas"],
"masculino-carteiras": ["Masculino", "Acessrios"],
"masculino-casacos": ["Masculino", "Roupas"],
"masculino-chinelos": ["Masculino", "Calados"],
"masculino-chuteiras": ["Masculino", "Esporte"],
"masculino-ciclismo": ["Masculino", "Esporte"],
"masculino-cintos": ["Masculino", "Acessrios"],
"masculino-coletes": ["Masculino", "Roupas"],
"masculino-corrida": ["Masculino", "Esporte"],
"masculino-cueca": ["Masculino", "Roupas"],
"masculino-equipamentos": ["Masculino", "Esporte"],
"masculino-gorros": ["Masculino", "Acessrios"],
"masculino-jaquetas": ["Masculino", "Roupas"],
"masculino-kimonos": ["Masculino", "Esporte"],
"masculino-lingeries": ["Masculino", "Roupas"],
"masculino-luvas": ["Masculino", "Acessrios"],
"masculino-meias": ["Masculino", "Roupas"],
"masculino-mocassins": ["Masculino", "Roupas"],
"masculino-moletom": ["Masculino", "Roupas"],
"masculino-moletons": ["Masculino", "Roupas"],
"masculino-oculos": ["Masculino", "Acessrios"],
"masculino-polos": ["Masculino", "Roupas"],
"masculino-protetores": ["Masculino", "Esporte"],
"masculino-relogios": ["Masculino", "Acessrios"],
"masculino-roupas": ["Masculino", "Roupas"],
"masculino-sacos": ["Masculino", "Esporte"],
"masculino-saias": ["Masculino", "Roupas"],
"masculino-sapatenis": ["Masculino", "Calados"],
"masculino-sapatilhas": ["Masculino", "Calados"],
"masculino-shorts": ["Masculino", "Roupas"],
"masculino-sungas": ["Masculino", "Roupas"],
"masculino-tenis": ["Masculino", "Calados"],
"masculino-vestidos": ["Masculino", "Roupas"],
"masculino-wetsuits": ["Masculino", "Esporte"],
"menina-acessorios": ["Infantil", "Acessrios"],
"menina-bermudas": ["Infantil", "Roupas"],
"menina-bijouterias": ["Infantil", "Acessrios"],
"menina-blusas": ["Infantil", "Roupas"],
"menina-bodys": ["Infantil", "Roupas"],
"menina-bolsas": ["Infantil", "Acessrios"],
"menina-botas": ["Infantil", "Calados"],
"menina-calcados": ["Infantil", "Calados"],
"menina-camisetas": ["Infantil", "Roupas"],
"menina-chinelos": ["Infantil", "Calados"],
"menina-lingeries": ["Infantil", "Roupas"],
"menina-macaquinhos": ["Infantil", "Roupas"],
"menina-mochilas": ["Infantil", "Acessrios"],
"menina-roupas": ["Infantil", "Roupas"],
"menina-saias": ["Infantil", "Roupas"],
"menina-sapatilhas": ["Infantil", "Calados"],
"menina-slippers": ["Infantil", "Calados"],
"menina-tenis": ["Infantil", "Calados"],
"menina-vestidos": ["Infantil", "Roupas"],
"menino-acessorios": ["Infantil", "Acessrios"],
"menino-bermudas": ["Infantil", "Roupas"],
"menino-botas": ["Infantil", "Calados"],
"menino-calcados": ["Infantil", "Calados"],
"menino-calcas": ["Infantil", "Roupas"],
"menino-camisetas": ["Infantil", "Roupas"],
"menino-chinelos": ["Infantil", "Calados"],
"menino-cueca": ["Infantil", "Roupas"],
"menino-jaquetas": ["Infantil", "Roupas"],
"menino-mochilas": ["Infantil", "Acessrios"],
"menino-polos": ["Infantil", "Roupas"],
"menino-relogios": ["Infantil", "Acessrios"],
"menino-roupas": ["Infantil", "Roupas"],
"menino-sapatenis": ["Infantil", "Calados"],
"menino-sapatilhas": ["Infantil", "Calados"],
"menino-tenis": ["Infantil", "Calados"],
"unissex-acessorios": ["Unissex", "Acessrios"],
"unissex-alpargatas": ["Unissex", "Roupas"],
"unissex-bermudas": ["Unissex", "Roupas"],
"unissex-bijouterias": ["Unissex", "Acessrios"],
"unissex-blusas": ["Unissex", "Roupas"],
"unissex-bodys": ["Unissex", "Roupas"],
"unissex-bolsas": ["Unissex", "Acessrios"],
"unissex-bones": ["Unissex", "Acessrios"],
"unissex-botas": ["Unissex", "Roupas"],
"unissex-cachecois": ["Unissex", "Roupas"],
"unissex-calcados": ["Unissex", "Roupas"],
"unissex-calcas": ["Unissex", "Roupas"],
"unissex-camisas": ["Unissex", "Roupas"],
"unissex-camisetas": ["Unissex", "Roupas"],
"unissex-carteiras": ["Unissex", "Acessrios"],
"unissex-chinelos": ["Unissex", "Roupas"],
"unissex-ciclismo": ["Unissex", "Esporte"],
"unissex-cintos": ["Unissex", "Acessrios"],
"unissex-corrida": ["Unissex", "Esporte"],
"unissex-cueca": ["Unissex", "Roupas"],
"unissex-equipamentos": ["Unissex", "Esporte"],
"unissex-jaquetas": ["Unissex", "Roupas"],
"unissex-kimonos": ["Unissex", "Esporte"],
"unissex-lingeries": ["Unissex", "Roupas"],
"unissex-luvas": ["Unissex", "Roupas"],
"unissex-meias": ["Unissex", "Roupas"],
"unissex-mocassins": ["Unissex", "Roupas"],
"unissex-mochilas": ["Unissex", "Roupas"],
"unissex-moletons": ["Unissex", "Roupas"],
"unissex-oculos": ["Unissex", "Acessrios"],
"unissex-protetores": ["Unissex", "Esporte"],
"unissex-relogios": ["Unissex", "Acessrios"],
"unissex-roupas": ["Unissex", "Roupas"],
"unissex-sapatenis": ["Unissex", "Roupas"],
"unissex-sapatilhas": ["Unissex", "Roupas"],
"unissex-shorts": ["Unissex", "Roupas"],
"unissex-sungas": ["Unissex", "Roupas"],
"unissex-tenis": ["Unissex", "Roupas"],
"unissex-toucas": ["Unissex", "Acessrios"],
"unissex-vestidos": ["Unissex", "Roupas"],
"unissex-wetsuits": ["Unissex", "Esporte"]
},
"farfetch": {
"kids-luxe-meninas - roupa infantil": ["Infantil", "Roupas"],
"kids-luxe-roupa infantil": ["Infantil", "Roupas"],
"kids-luxe-roupa para bebe": ["Infantil", "Roupas"],
"kids-luxe-roupas para bebe menina": ["Infantil", "Roupas"],
"men-luxe-acessorios": ["Masculino", "Acessrios"],
"men-luxe-bijoux & joias": ["Masculino", "Acessrios"],
"men-luxe-bolsas": ["Masculino", "Acessrios"],
"men-luxe-fitness": ["Masculino", "Esporte"],
"men-luxe-roupas": ["Masculino", "Roupas"],
"men-luxe-sapatos": ["Masculino", "Calados"],
"unisex-luxe-acessorios": ["Unissex", "Acessrios"],
"unisex-luxe-bijoux & joias": ["Unissex", "Acessrios"],
"unisex-luxe-bolsas": ["Unissex", "Acessrios"],
"unisex-luxe-fitness": ["Unissex", "Esporte"],
"unisex-luxe-roupas": ["Unissex", "Roupas"],
"unisex-luxe-sapatos": ["Unissex", "Calados"],
"women-luxe-acessorios": ["Feminino", "Acessrios"],
"women-luxe-bijoux & joias": ["Feminino", "Acessrios"],
"women-luxe-bolsas": ["Feminino", "Acessrios"],
"women-luxe-fitness": ["Feminino", "Esporte"],
"women-luxe-roupas": ["Feminino", "Roupas"],
"women-luxe-sapatos": ["Feminino", "Calados"]
},
"passarela": {
"feminino-acessorios": ["Feminino", "Acessrios"],
"feminino-calcados": ["Feminino", "Calados"],
"feminino-moda intima": ["Feminino", "Roupas"],
"feminino-roupas": ["Feminino", "Roupas"],
"infantil-acessorios": ["Infantil", "Acessrios"],
"infantil-calcados": ["Infantil", "Calados"],
"infantil-moda intima": ["Infantil", "Roupas"],
"infantil-roupas": ["Infantil", "Roupas"],
"masculino-acessorios": ["Masculino", "Acessrios"],
"masculino-calcados": ["Masculino", "Calados"],
"masculino-moda intima": ["Masculino", "Roupas"],
"masculino-roupas": ["Masculino", "Roupas"],
"unissex-acessorios": ["Unissex", "Acessrios"]
}
}
BOT_NAME = 'scrapper'
SPIDER_MODULES = ['scrapper.spiders']
NEWSPIDER_MODULE = 'scrapper.spiders'
LOG_LEVEL='INFO'
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'scrapper (+http://www.yourdomain.com)'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Configure maximum concurrent requests performed by Scrapy (default: 16)
#CONCURRENT_REQUESTS = 32
# Configure a delay for requests for the same website (default: 0)
# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
# See also autothrottle settings and docs
#DOWNLOAD_DELAY = 3
# The download delay setting will honor only one of:
#CONCURRENT_REQUESTS_PER_DOMAIN = 16
#CONCURRENT_REQUESTS_PER_IP = 16
# Disable cookies (enabled by default)
#COOKIES_ENABLED = False
# Disable Telnet Console (enabled by default)
#TELNETCONSOLE_ENABLED = False
# Override the default request headers:
#DEFAULT_REQUEST_HEADERS = {
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
# 'Accept-Language': 'en',
#}
# Enable or disable spider middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
# SPIDER_MIDDLEWARES = {
# 'scrapy_splash.SplashDeduplicateArgsMiddleware': 100,
# }
# Enable or disable downloader middlewares
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
# DOWNLOADER_MIDDLEWARES = {
# 'scrapy_splash.SplashCookiesMiddleware': 723,
# 'scrapy_splash.SplashMiddleware': 725,
# 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware': 810,
# }
# Scrapy currently doesnt provide a way to override request fingerprints calculation globally,
# so you will also have to set a custom DUPEFILTER_CLASS and a custom cache storage backend:
# DUPEFILTER_CLASS = 'scrapy_splash.SplashAwareDupeFilter'
# HTTPCACHE_STORAGE = 'scrapy_splash.SplashAwareFSCacheStorage'
# Enable or disable extensions
# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
#EXTENSIONS = {
# 'scrapy.extensions.telnet.TelnetConsole': None,
#}
# Configure item pipelines
# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
# 'scrapy.pipelines.images.ImagesPipeline': 1,
'scrapper.pipelines.CleanPipeline': 100,
'scrapper.pipelines.MongoDBPipeline': 200
}
# IMAGE DIRECTORY
# IMAGES_STORE = os.path.abspath(os.path.dirname(__file__)) + '/spiders/images'
# ALLOW IMAGE REDIRECT
MEDIA_ALLOW_REDIRECTS = True
# SPLASH_URL = 'http://localhost:8050/'
# PROD DB
MONGODB_CONNECTION_STRING = 'mongodb://admin:azzaropourhome2@ds155411.mlab.com:55411/fashionbot'
# LOCAL DEV
# MONGODB_CONNECTION_STRING = 'mongodb://localhost:27017/fashionbot'
MONGODB_SERVER = 'ds155411.mlab.com:55411/fashionbot'
MONGODB_USER = 'admin'
MONGODB_PASSWORD = 'azzaropourhome2'
MONGODB_PORT = 27017
MONGODB_DB = 'fashionbot'
MONGODB_COLLECTION = 'clothes'
# Enable and configure the AutoThrottle extension (disabled by default)
# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
#AUTOTHROTTLE_ENABLED = True
# The initial download delay
#AUTOTHROTTLE_START_DELAY = 5
# The maximum download delay to be set in case of high latencies
#AUTOTHROTTLE_MAX_DELAY = 60
# The average number of requests Scrapy should be sending in parallel to
# each remote server
#AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
# Enable showing throttling stats for every response received:
#AUTOTHROTTLE_DEBUG = False
# Enable and configure HTTP caching (disabled by default)
# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
#HTTPCACHE_ENABLED = True
#HTTPCACHE_EXPIRATION_SECS = 0
#HTTPCACHE_DIR = 'httpcache'
#HTTPCACHE_IGNORE_HTTP_CODES = []
#HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
| 43.634615 | 109 | 0.661021 |
016a2008401fbef8b48e430f13646f4e48a823a9 | 1,292 | py | Python | datacube_classification/models.py | brazil-data-cube/datacube-classification | 727c045c58c06fd87cb26d408201e34b9e471e9c | [
"MIT"
] | 2 | 2021-04-20T03:26:50.000Z | 2021-04-20T21:20:27.000Z | datacube_classification/models.py | brazil-data-cube/datacube-classification | 727c045c58c06fd87cb26d408201e34b9e471e9c | [
"MIT"
] | 2 | 2021-04-20T03:14:09.000Z | 2021-04-20T03:14:53.000Z | datacube_classification/models.py | brazil-data-cube/datacube-classification | 727c045c58c06fd87cb26d408201e34b9e471e9c | [
"MIT"
] | null | null | null | #
# This file is part of datacube-classification
# Copyright (C) 2021 INPE.
#
# datacube-classification Library is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
"""classification models module"""
import pandas as pd
def train_sklearn_model(model, labeled_timeseries: pd.DataFrame, label_col="label"):
"""Train a sklearn model using the time series extracted with the
`datacube_classification.sits.datacube_get_sits` function
This function receives time series with associated labels and performs the model training. To do this, each
of the instances present in the input table (labeled_timeseries) must contain a column (label_col) with the
associated label information
Args:
model (object): scikit-learn classification model
labeled_timeseries (pd.DataFrame): table with time-series extracted from a data cube. Each instance must be have
a label associated
label_col (str): column where labels is in `labeled_timeseries`
Returns:
object: scikit-learn treined model
"""
x = labeled_timeseries[labeled_timeseries.columns.difference([label_col])]
y = labeled_timeseries[label_col].astype(int)
return model.fit(x, y)
| 35.888889 | 120 | 0.745356 |
016cf65bfe0fb46c06e740cb0bad0c906040020a | 421 | py | Python | test/test.py | backav/python-heartbeat-maker | f6b2f914ec2dd6e104f8ce746fdc422f97f3c8cf | [
"MIT"
] | null | null | null | test/test.py | backav/python-heartbeat-maker | f6b2f914ec2dd6e104f8ce746fdc422f97f3c8cf | [
"MIT"
] | null | null | null | test/test.py | backav/python-heartbeat-maker | f6b2f914ec2dd6e104f8ce746fdc422f97f3c8cf | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from redis import StrictRedis
from HeartbeatMaker import HeartbeatMaker
import arrow
maker = HeartbeatMaker('redis://localhost:6379/0', 'test-beat', test)
# maker.clean()
# maker.beat_it('bac', 6,'bac-par')
# maker.beat_it('shawn', 2,'par')
# maker.omit_it('jack')
maker.beat_it('jack', 5,'par')
# maker.start()
| 19.136364 | 69 | 0.657957 |
016d5efe3c27993b8afc080b9aed799c0438da3c | 2,304 | py | Python | main.py | RushanNotOfficial/adminweapons | d9738fb0302b64ef7d54b22b14e913d1ff7de79e | [
"Apache-2.0"
] | 1 | 2021-09-17T17:13:10.000Z | 2021-09-17T17:13:10.000Z | main.py | RushanNotOfficial/adminweapons | d9738fb0302b64ef7d54b22b14e913d1ff7de79e | [
"Apache-2.0"
] | null | null | null | main.py | RushanNotOfficial/adminweapons | d9738fb0302b64ef7d54b22b14e913d1ff7de79e | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 RushanNotOfficial#1146. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""
Run the main bot
"""
from discord_components import DiscordComponents # library for interacting with buttons and components
from discord.ext import commands # library for make a client and registering commands
TOKEN = ""
client = commands.Bot(command_prefix="") # make the bot object
client.remove_command("help") # remove the basic help command as we have a better one
cogs = ("cogs.help") # cogs which we want to register. (using a tuple as it takes less space than a array)
for cog in cogs:
client.load_extension(cog) # load the cog/extension
print(f"Loaded {cog} cog") # print the cog name to console
client.run(TOKEN) # now, lets run the bot | 53.581395 | 150 | 0.601997 |
016d6e7e508bdd3f4bc8579c90a03098e462920c | 1,076 | py | Python | src/classes/widgets/engine_gauge.py | bergthor13/VehicleGPS | 643413b3cb910102689081d692223a4a03fccea4 | [
"MIT"
] | 3 | 2019-06-21T23:39:22.000Z | 2020-08-17T03:39:04.000Z | src/classes/widgets/engine_gauge.py | bergthor13/VehicleGPS | 643413b3cb910102689081d692223a4a03fccea4 | [
"MIT"
] | null | null | null | src/classes/widgets/engine_gauge.py | bergthor13/VehicleGPS | 643413b3cb910102689081d692223a4a03fccea4 | [
"MIT"
] | 1 | 2020-02-04T16:13:06.000Z | 2020-02-04T16:13:06.000Z | """File containing a class for the main gauge."""
from tkinter import font, Label, Frame
from classes.widgets.main_gauge import MainGauge
from classes.pub_sub import Subscriber | 32.606061 | 72 | 0.572491 |
016e32f2a963118067a022a4358ef9d531d71194 | 280 | py | Python | aml/__init__.py | ArvinSKushwaha/AML | 3594a861cfe1733d6a92a293bf7737e2ec2be5df | [
"MIT"
] | null | null | null | aml/__init__.py | ArvinSKushwaha/AML | 3594a861cfe1733d6a92a293bf7737e2ec2be5df | [
"MIT"
] | null | null | null | aml/__init__.py | ArvinSKushwaha/AML | 3594a861cfe1733d6a92a293bf7737e2ec2be5df | [
"MIT"
] | null | null | null | from .core import (
mean,
sum,
exp,
sin,
cos,
tan,
log,
tensor,
grad_tensor,
zeros,
ones,
randn,
rand,
Tensor,
argmax,
)
from .linear import Linear
from .model import Module, Sequential
from .sampler import TensorSample
| 13.333333 | 37 | 0.589286 |
0170b972d86c93a3e3cdb19cde4605229cdb91d4 | 4,358 | py | Python | packages/augur-core/tests/gov/test_gov.py | jeremyschlatter/augur | 4dbfe476905c1c032231ac18b5e4e9cb817c90d4 | [
"MIT"
] | 3 | 2021-05-10T06:44:19.000Z | 2021-06-16T00:04:27.000Z | packages/augur-core/tests/gov/test_gov.py | Penny-Admixture/augur | 374366d15f455a1814cc1d10b1219455a9ac71d0 | [
"MIT"
] | null | null | null | packages/augur-core/tests/gov/test_gov.py | Penny-Admixture/augur | 374366d15f455a1814cc1d10b1219455a9ac71d0 | [
"MIT"
] | 1 | 2021-04-02T12:47:01.000Z | 2021-04-02T12:47:01.000Z | from eth_tester.exceptions import TransactionFailed
from utils import captureFilteredLogs, AssertLog, nullAddress, TokenDelta, PrintGasUsed
from pytest import raises, mark
pytestmark = mark.skip(reason="We might not even need governance and currently dont account for transfering ownership")
| 39.981651 | 172 | 0.750344 |
0170d25b5b5c179dc15a428fac48dd41cba9b842 | 700 | py | Python | terrascript/resource/hashicorp/ad.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 507 | 2017-07-26T02:58:38.000Z | 2022-01-21T12:35:13.000Z | terrascript/resource/hashicorp/ad.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 135 | 2017-07-20T12:01:59.000Z | 2021-10-04T22:25:40.000Z | terrascript/resource/hashicorp/ad.py | mjuenema/python-terrascript | 6d8bb0273a14bfeb8ff8e950fe36f97f7c6e7b1d | [
"BSD-2-Clause"
] | 81 | 2018-02-20T17:55:28.000Z | 2022-01-31T07:08:40.000Z | # terrascript/resource/hashicorp/ad.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:10:57 UTC)
import terrascript
__all__ = [
"ad_computer",
"ad_gplink",
"ad_gpo",
"ad_gpo_security",
"ad_group",
"ad_group_membership",
"ad_ou",
"ad_user",
]
| 14.583333 | 73 | 0.71 |
0170f03d5c6113a721972e11f7d310051390f158 | 557 | py | Python | train_flickr.py | raph-m/pytorch-CycleGAN-and-pix2pix | 41891a12fb4f92ebef60e82fe533110c2d5a6311 | [
"BSD-3-Clause"
] | null | null | null | train_flickr.py | raph-m/pytorch-CycleGAN-and-pix2pix | 41891a12fb4f92ebef60e82fe533110c2d5a6311 | [
"BSD-3-Clause"
] | null | null | null | train_flickr.py | raph-m/pytorch-CycleGAN-and-pix2pix | 41891a12fb4f92ebef60e82fe533110c2d5a6311 | [
"BSD-3-Clause"
] | null | null | null | import sys
from utils import my_train, flickr_train_params, flickr_params, my_test, copy_networks
if __name__ == "__main__":
do_import = True
first_arg = sys.argv[0]
if do_import:
copy_networks(model_to_import="celeba_cycle", iter="2")
flickr_train_params["continue_train"] = True
flickr_params["name"] = "flickr_import"
params = flickr_params.copy()
params.update(flickr_train_params)
my_train(params, first_arg)
my_test(flickr_params, first_arg, benchmark=True, results_dir="benchmark_results")
| 25.318182 | 86 | 0.721724 |
01718641d209b93e71922a83a09841a7c405d585 | 3,153 | py | Python | setup.py | insolor/pymorphy2 | 92d546f042ff14601376d3646242908d5ab786c1 | [
"MIT"
] | 859 | 2015-01-05T00:48:23.000Z | 2022-03-19T07:42:23.000Z | setup.py | insolor/pymorphy2 | 92d546f042ff14601376d3646242908d5ab786c1 | [
"MIT"
] | 106 | 2015-01-03T12:21:56.000Z | 2022-03-30T11:07:46.000Z | setup.py | insolor/pymorphy2 | 92d546f042ff14601376d3646242908d5ab786c1 | [
"MIT"
] | 118 | 2015-01-05T21:10:35.000Z | 2022-03-15T14:29:29.000Z | #!/usr/bin/env python
import sys
import platform
from setuptools import setup
# from Cython.Build import cythonize
# TODO: use environment markres instead of Python code in order to
# allow building proper wheels. Markers are not enabled right now because
# of setuptools/wheel incompatibilities and the 'pip >= 6.0' requirement.
# extras_require = {
# 'fast:platform_python_implementation==CPython': ["DAWG>=0.7.7"],
# 'fast:platform_python_implementation==CPython and python_version<3.5': [
# "fastcache>=1.0.2"
# ],
# ':python_version<"3.0"': [
# "backports.functools_lru_cache>=1.0.1",
# ],
# }
is_cpython = platform.python_implementation() == 'CPython'
py_version = sys.version_info[:2]
install_requires = [
'dawg-python >= 0.7.1',
'pymorphy2-dicts-ru >=2.4, <3.0',
'docopt >= 0.6',
]
if py_version < (3, 0):
install_requires.append("backports.functools_lru_cache >= 1.0.1")
extras_require = {'fast': []}
if is_cpython:
extras_require['fast'].append("DAWG >= 0.8")
if py_version < (3, 5):
# lru_cache is optimized in Python 3.5
extras_require['fast'].append("fastcache >= 1.0.2")
setup(
name='pymorphy2',
version=get_version(),
author='Mikhail Korobov',
author_email='kmike84@gmail.com',
url='https://github.com/kmike/pymorphy2/',
description='Morphological analyzer (POS tagger + inflection engine) for Russian language.',
long_description=open('README.rst').read(),
license='MIT license',
packages=[
'pymorphy2',
'pymorphy2.units',
'pymorphy2.lang',
'pymorphy2.lang.ru',
'pymorphy2.lang.uk',
'pymorphy2.opencorpora_dict',
],
entry_points={
'console_scripts': ['pymorphy = pymorphy2.cli:main']
},
install_requires=install_requires,
extras_require=extras_require,
zip_safe=False,
# ext_modules=cythonize([
# 'pymorphy2/*.py',
# 'pymorphy2/units/*.py',
# 'pymorphy2/opencorpora_dict/*.py',
# ], annotate=True, profile=True),
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: Russian',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Text Processing :: Linguistic',
],
)
| 31.217822 | 96 | 0.625119 |
01737ac1253524fca8701279c0c0189f76386d90 | 8,031 | py | Python | habitat/tasks/rearrange/utils.py | elombardi2/habitat-lab | 02326fffe1c781fda69b23d7d89ac6d11bd37ca2 | [
"MIT"
] | null | null | null | habitat/tasks/rearrange/utils.py | elombardi2/habitat-lab | 02326fffe1c781fda69b23d7d89ac6d11bd37ca2 | [
"MIT"
] | null | null | null | habitat/tasks/rearrange/utils.py | elombardi2/habitat-lab | 02326fffe1c781fda69b23d7d89ac6d11bd37ca2 | [
"MIT"
] | 1 | 2021-09-09T08:15:24.000Z | 2021-09-09T08:15:24.000Z | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import hashlib
import os
import os.path as osp
import pickle
import time
import attr
import gym
import magnum as mn
import numpy as np
import quaternion
import habitat_sim
from habitat_sim.nav import NavMeshSettings
from habitat_sim.physics import MotionType
def rearrange_collision(
colls,
snapped_obj_id,
count_obj_colls,
verbose=False,
ignore_names=None,
ignore_base=True,
):
"""
Defines what counts as a collision for the Rearrange environment execution
"""
# Filter out any collisions from the base
if ignore_base:
colls = [
x
for x in colls
if not ("base" in x[0]["link"] or "base" in x[1]["link"])
]
# Filter out any collisions with the ignore objects
colls = list(filter(should_keep, colls))
# Check for robot collision
robo_obj_colls = 0
robo_scene_colls = 0
robo_scene_matches = get_collision_matches("fetch", colls, "name")
for match in robo_scene_matches:
urdf_on_urdf = (
match[0]["type"] == "URDF" and match[1]["type"] == "URDF"
)
with_stage = coll_prop(match, "Stage", "type")
fetch_on_fetch = (
match[0]["name"] == "fetch" and match[1]["name"] == "fetch"
)
if fetch_on_fetch:
continue
if urdf_on_urdf or with_stage:
robo_scene_colls += 1
else:
robo_obj_colls += 1
# Checking for holding object collision
obj_scene_colls = 0
if count_obj_colls and snapped_obj_id is not None:
matches = get_collision_matches(
"id %i" % snapped_obj_id, colls, "link"
)
for match in matches:
if coll_name(match, "fetch"):
continue
obj_scene_colls += 1
total_colls = robo_obj_colls + robo_scene_colls + obj_scene_colls
return total_colls > 0, CollDetails(
obj_scene_colls=min(obj_scene_colls, 1),
robo_obj_colls=min(robo_obj_colls, 1),
robo_scene_colls=min(robo_scene_colls, 1),
)
def recover_nav_island_point(v, ref_v, sim):
"""
Snaps a point to the LARGEST island.
"""
nav_vs = sim.pathfinder.build_navmesh_vertices()
ref_r = sim.pathfinder.island_radius(ref_v)
nav_vs_r = {
i: sim.pathfinder.island_radius(nav_v)
for i, nav_v in enumerate(nav_vs)
}
# Get the points closest to "v"
v_dist = np.linalg.norm(v - nav_vs, axis=-1)
ordered_idxs = np.argsort(v_dist)
# Go through the closest points until one has the same island radius.
for i in ordered_idxs:
if nav_vs_r[i] == ref_r:
return nav_vs[i]
print("Could not find point off of island")
return v
CACHE_PATH = "./data/cache"
| 28.784946 | 78 | 0.625949 |
01747966cb8b478038f5ca30657c325c98657e48 | 3,614 | py | Python | park_piper.py | skarplab/park_piper | 6f51fdb21fa8f7e53a731fb118370b50270788f8 | [
"MIT"
] | null | null | null | park_piper.py | skarplab/park_piper | 6f51fdb21fa8f7e53a731fb118370b50270788f8 | [
"MIT"
] | 1 | 2019-11-05T19:06:51.000Z | 2019-11-05T19:06:51.000Z | park_piper.py | skarplab/park_piper | 6f51fdb21fa8f7e53a731fb118370b50270788f8 | [
"MIT"
] | null | null | null | ###############
## LIBRARIES ##
###############
import click
from copy import deepcopy
from pprint import pprint
from arcgis.gis import GIS
from arcgis import features
import geopandas as gpd
##################
## FUNCTION(S) ##
##################
if __name__ == "__main__":
main() | 48.186667 | 280 | 0.710017 |
0174e0a9353f91cac1b89d08d2f7d7e33badec5b | 1,646 | py | Python | programs/mv.py | RaInta/PyOS | 0e38faba3f3b9958316f77b2163118ec8eb8845f | [
"MIT"
] | null | null | null | programs/mv.py | RaInta/PyOS | 0e38faba3f3b9958316f77b2163118ec8eb8845f | [
"MIT"
] | null | null | null | programs/mv.py | RaInta/PyOS | 0e38faba3f3b9958316f77b2163118ec8eb8845f | [
"MIT"
] | null | null | null | # PyOS
# Made for Python 2.7
# programs/mv.py
# Import Libraries
# PyOS Scripts
import internal.extra
import os
from programs.cp import displayCwdFiles, getFileOrigin
| 44.486486 | 133 | 0.669502 |
0174f6ef49b2600601fc8286f239c0c51ed868ee | 1,867 | py | Python | 0382_LinkedListRandomNode/python/solution.py | jeffvswanson/LeetCode | 6bc7d6cad3c2b1bd6ccb2616ec081fb5eb51ccc8 | [
"MIT"
] | null | null | null | 0382_LinkedListRandomNode/python/solution.py | jeffvswanson/LeetCode | 6bc7d6cad3c2b1bd6ccb2616ec081fb5eb51ccc8 | [
"MIT"
] | null | null | null | 0382_LinkedListRandomNode/python/solution.py | jeffvswanson/LeetCode | 6bc7d6cad3c2b1bd6ccb2616ec081fb5eb51ccc8 | [
"MIT"
] | null | null | null | """
382. Linked List Random Node
Given a singly linked list, return a random node's value from the linked list. Each node
must have the same probability of being chosen.
Implement the Solution class:
Solution(ListNode head) Initializes the object with the integer array nums.
int getRandom() Chooses a node randomly from the list and returns its value. All the
nodes of the list should be equally likely to be choosen.
Examples
--------
Example 1:
Input
["Solution", "getRandom", "getRandom", "getRandom", "getRandom", "getRandom"]
[[[1, 2, 3]], [], [], [], [], []]
Output
[null, 1, 3, 2, 2, 3]
Explanation
solution = Solution([1, 2, 3]);
solution.getRandom(); // return 1
solution.getRandom(); // return 3
solution.getRandom(); // return 2
solution.getRandom(); // return 2
solution.getRandom(); // return 3
// getRandom() should return either 1, 2, or 3 randomly. Each element should have
equal probability of returning.
Constraints
-----------
* The number of nodes in the linked list will be in the range [1, 104].
* -104 <= Node.val <= 104
* At most 104 calls will be made to getRandom.
"""
import random
from typing import Optional
# Definition for singly-linked list.
| 28.723077 | 88 | 0.644885 |
0174f77e9de6cf1e78caa97b728122d68f161063 | 3,003 | py | Python | tests/subscriptions/test_store.py | fpacifici/snuba | cf732b71383c948f9387fbe64e9404ca71f8e9c5 | [
"Apache-2.0"
] | null | null | null | tests/subscriptions/test_store.py | fpacifici/snuba | cf732b71383c948f9387fbe64e9404ca71f8e9c5 | [
"Apache-2.0"
] | null | null | null | tests/subscriptions/test_store.py | fpacifici/snuba | cf732b71383c948f9387fbe64e9404ca71f8e9c5 | [
"Apache-2.0"
] | null | null | null | from datetime import timedelta
from uuid import uuid1
from snuba.redis import redis_client
from snuba.subscriptions.data import SubscriptionData
from snuba.subscriptions.store import RedisSubscriptionDataStore
from tests.subscriptions import BaseSubscriptionTest
| 39 | 74 | 0.640027 |
01756befa2192d53cb57f12407d058724b5d5f3a | 3,833 | py | Python | tests/app/models/test_broadcast_message.py | alphagov/notify-admin-frontend | 70f2a6a97aefe2432d7a3b54dc1555c030dd3693 | [
"MIT"
] | 33 | 2016-01-11T20:16:17.000Z | 2021-11-23T12:50:29.000Z | tests/app/models/test_broadcast_message.py | alphagov/notify-admin-frontend | 70f2a6a97aefe2432d7a3b54dc1555c030dd3693 | [
"MIT"
] | 1,249 | 2015-11-30T16:43:21.000Z | 2022-03-24T13:04:55.000Z | tests/app/models/test_broadcast_message.py | alphagov/notify-admin-frontend | 70f2a6a97aefe2432d7a3b54dc1555c030dd3693 | [
"MIT"
] | 36 | 2015-12-02T09:49:26.000Z | 2021-04-10T18:05:41.000Z | import pytest
from app.broadcast_areas.models import CustomBroadcastAreas
from app.models.broadcast_message import BroadcastMessage
from tests import broadcast_message_json
| 28.604478 | 89 | 0.604226 |
0176442d3722d717b493ddc5a58d8dea96dab8d8 | 521 | py | Python | UNF/data/field.py | waterzxj/UNF | 5eda8e7c60116735f595f4b21b24547708b36cf5 | [
"Apache-2.0"
] | 86 | 2020-02-23T13:38:11.000Z | 2022-03-01T12:09:28.000Z | UNF/data/field.py | Dreamliking/UNF | 5eda8e7c60116735f595f4b21b24547708b36cf5 | [
"Apache-2.0"
] | 2 | 2020-04-20T08:33:05.000Z | 2020-05-13T13:43:08.000Z | UNF/data/field.py | Dreamliking/UNF | 5eda8e7c60116735f595f4b21b24547708b36cf5 | [
"Apache-2.0"
] | 14 | 2020-03-07T05:21:44.000Z | 2021-05-09T16:57:23.000Z | #coding:utf-8
"""
"""
from torchtext.data.field import RawField, Field, LabelField
| 17.965517 | 60 | 0.596929 |
017a9e7cf566c8e735c6560428aeffefe5652de2 | 9,460 | py | Python | nilmtk_contrib/disaggregate/dsc.py | PiaDiepman/NILMTK-contrib | cd0b4337c9d87d71b3e88ad6581e5377ed8d82aa | [
"Apache-2.0"
] | 75 | 2019-07-05T06:43:10.000Z | 2022-03-30T09:18:51.000Z | nilmtk_contrib/disaggregate/dsc.py | PiaDiepman/NILMTK-contrib | cd0b4337c9d87d71b3e88ad6581e5377ed8d82aa | [
"Apache-2.0"
] | 52 | 2019-06-10T14:36:40.000Z | 2022-03-25T16:28:05.000Z | nilmtk_contrib/disaggregate/dsc.py | PiaDiepman/NILMTK-contrib | cd0b4337c9d87d71b3e88ad6581e5377ed8d82aa | [
"Apache-2.0"
] | 50 | 2019-06-14T05:31:28.000Z | 2022-03-23T17:38:39.000Z | from __future__ import print_function, division
from warnings import warn
from nilmtk.disaggregate import Disaggregator
import pandas as pd
import numpy as np
from collections import OrderedDict
import matplotlib.pyplot as plt
from sklearn.decomposition import MiniBatchDictionaryLearning, SparseCoder
from sklearn.metrics import mean_squared_error
import time
import warnings
warnings.filterwarnings("ignore")
| 46.146341 | 175 | 0.647992 |
017c053656950468180fe8ad9c2d0be0139dd386 | 1,099 | py | Python | qark/test/test_plugins/test_task_affinity.py | The-Repo-Depot/qark | 8f7cd41a95b4980d544ff16fa9b3896cdf3a392d | [
"Apache-2.0"
] | 1 | 2020-02-14T02:46:31.000Z | 2020-02-14T02:46:31.000Z | qark/test/test_plugins/test_task_affinity.py | The-Repo-Depot/qark | 8f7cd41a95b4980d544ff16fa9b3896cdf3a392d | [
"Apache-2.0"
] | null | null | null | qark/test/test_plugins/test_task_affinity.py | The-Repo-Depot/qark | 8f7cd41a95b4980d544ff16fa9b3896cdf3a392d | [
"Apache-2.0"
] | null | null | null | from plugins import PluginUtil
from plugins.task_affinity import TaskAffinityPlugin
plugin = TaskAffinityPlugin()
if __name__ == '__main__':
test_regex()
test_regex1()
test_regex2()
test_regex3()
test_regex4()
test_regex5()
| 28.921053 | 65 | 0.754322 |
017df8740dfde25e6ca97dee8d4e923144b40c7c | 7,033 | py | Python | deprecated/demo/tutorial_5/qr_code.py | mfkiwl/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | [
"BSD-3-Clause"
] | 2,111 | 2019-01-29T07:01:32.000Z | 2022-03-29T06:48:14.000Z | demo/tutorial_5/qr_code.py | Wayne-xixi/GAAS | 308ff4267ccc6fcad77eef07e21fa006cc2cdd5f | [
"BSD-3-Clause"
] | 131 | 2019-02-18T10:56:18.000Z | 2021-09-27T12:07:00.000Z | demo/tutorial_5/qr_code.py | Wayne-xixi/GAAS | 308ff4267ccc6fcad77eef07e21fa006cc2cdd5f | [
"BSD-3-Clause"
] | 421 | 2019-02-12T07:59:18.000Z | 2022-03-27T05:22:01.000Z | from __future__ import print_function
import pyzbar.pyzbar as pyzbar
import numpy as np
import cv2
if __name__ == '__main__':
train_image = cv2.imread('target.png')
query_image = cv2.imread('target.png')
cv2.imwrite("train_image.png", train_image)
qr = QRdetect(query_image)
R, t = qr.process_image(train_image)
print("R: ", R)
print("t: ", t)
| 30.578261 | 116 | 0.570027 |
017eb9741cc803273ee726ff5eb9f25a88afc42c | 1,124 | py | Python | tests/test_comment.py | githaefrancis/fluent-exchange | 1bf2597f3baba79c36c816146992842fcc85a08f | [
"MIT"
] | null | null | null | tests/test_comment.py | githaefrancis/fluent-exchange | 1bf2597f3baba79c36c816146992842fcc85a08f | [
"MIT"
] | null | null | null | tests/test_comment.py | githaefrancis/fluent-exchange | 1bf2597f3baba79c36c816146992842fcc85a08f | [
"MIT"
] | null | null | null | import unittest
from app.models import User,Role,Post,Comment
| 40.142857 | 168 | 0.758897 |
017f2c1c96c787b6d2e75710df80d07ac95d8ea9 | 881 | py | Python | utils/Logger.py | Team-Squad-Up/multigraph_transformer | 180a4dc172695d305ab8a945698cd24401d42e66 | [
"MIT"
] | 268 | 2019-12-24T05:27:57.000Z | 2022-03-31T13:59:30.000Z | utils/Logger.py | Team-Squad-Up/multigraph_transformer | 180a4dc172695d305ab8a945698cd24401d42e66 | [
"MIT"
] | 2 | 2020-08-10T02:57:57.000Z | 2021-01-05T06:19:40.000Z | utils/Logger.py | PengBoXiangShang/multigraph_transformer | 04aaf575a5242d44e08910a9583c623f14b61b62 | [
"MIT"
] | 26 | 2019-12-24T13:24:58.000Z | 2022-03-21T08:42:20.000Z | import logging
import os
| 29.366667 | 95 | 0.631101 |
017fe9e609d95e7d2936358460f2c94dafdfc951 | 1,429 | py | Python | Homework/HW3/src/solution.py | fuadaghazada/X-WORD | 9d2f1f23e3bda31a27e038c90fc9ee30b73f5539 | [
"MIT"
] | 2 | 2019-06-12T08:32:12.000Z | 2020-04-03T13:09:54.000Z | Homework/HW3/src/solution.py | fuadaghazada/X-WORD | 9d2f1f23e3bda31a27e038c90fc9ee30b73f5539 | [
"MIT"
] | null | null | null | Homework/HW3/src/solution.py | fuadaghazada/X-WORD | 9d2f1f23e3bda31a27e038c90fc9ee30b73f5539 | [
"MIT"
] | 2 | 2019-05-31T08:56:03.000Z | 2019-12-17T01:58:20.000Z | from state import print_solution_path
from search import BBS, A_star_search
from puzzle import generate
from write_to_file import write_to_csv, write_to_txt
'''
CS461 - Artificial Intelligence Homework 3
Group members:
* Fuad Aghazada
* Can zgrel
* aatay Sel
* Utku Mert Topuolu
* Kaan Kranbay
As heuristic function
h (sum of Eucledian distances of the tiles from their goal positions)
has been used
@authors: fuadaghazada, canozgurel
@date: 21/3/2019
'''
'''
Generating N distinct puzzles
'''
###### GENERATING 25 Distinct Puzzles #######
puzzles = generate_n_puzzles(25)
index = 1
path = None
# X and Y values for the puzzle solved with BBS and A*
data = []
for puzzle in puzzles:
path, num_moves_bbs = BBS(puzzle)
path, num_moves_a_star = A_star_search(puzzle)
data.append([index, num_moves_bbs, num_moves_a_star])
index += 1
# Write puzzles (initial states) to txt
write_to_txt(puzzles)
# Writing result into csv file
write_to_csv(data)
# Print the trace for the last puzzle
print("\n\n----Solution trace for last puzzle!----\n\n")
if path:
print_solution_path(path)
| 21.984615 | 77 | 0.686494 |
018015cf927908eea70db9b02fdbb5cdefd59ff5 | 6,224 | py | Python | LineNotifyBot/orderManager.py | cryptocat-miner/BitMexLineNotifyBot | 2388d5fbccd3e8b7110484a1c10bd490e4b13859 | [
"MIT"
] | 1 | 2019-09-23T12:34:18.000Z | 2019-09-23T12:34:18.000Z | LineNotifyBot/orderManager.py | cryptocat-miner/BitMexLineNotifyBot | 2388d5fbccd3e8b7110484a1c10bd490e4b13859 | [
"MIT"
] | null | null | null | LineNotifyBot/orderManager.py | cryptocat-miner/BitMexLineNotifyBot | 2388d5fbccd3e8b7110484a1c10bd490e4b13859 | [
"MIT"
] | null | null | null | import ccxt
from datetime import datetime
from datetime import timedelta
import calendar
import time
from enum import Enum
import ccxtWrapper
import math
import LineNotify
import orderInfo
| 38.9 | 171 | 0.621144 |
018153b0720e76bdbfa6aa63e1ed23fa87f47eb2 | 1,917 | py | Python | ๊ฐ์ ์๋ฃ/02-์๊ณ ๋ฆฌ์ฆ/autoindex.py | rhs0266/FastCampus | 88b5f4c18ebfb9ebf141ace644e40d2975ff665a | [
"MIT"
] | 407 | 2020-11-14T02:25:56.000Z | 2022-03-31T04:12:17.000Z | ๊ฐ์ ์๋ฃ/02-์๊ณ ๋ฆฌ์ฆ/autoindex.py | rhs0266/FastCampus | 88b5f4c18ebfb9ebf141ace644e40d2975ff665a | [
"MIT"
] | 48 | 2020-11-16T15:29:10.000Z | 2022-03-14T06:32:16.000Z | ๊ฐ์ ์๋ฃ/02-์๊ณ ๋ฆฌ์ฆ/autoindex.py | rhs0266/FastCampus | 88b5f4c18ebfb9ebf141ace644e40d2975ff665a | [
"MIT"
] | 78 | 2020-11-28T08:29:39.000Z | 2022-03-29T06:54:48.000Z | import os
from lxml import html
import requests
for chapter in get_dir_list('./'):
md_path = os.path.join(chapter, 'README.md')
new_md = []
with open(md_path, "r", encoding="UTF8") as f:
for line in f.readlines():
line = line.strip()
row = line.split('|')
numberStr : str = get_number(row[2])
if numberStr:
res = requests.get('http://boj.kr/' + numberStr)
res.raise_for_status()
res.encoding = 'UTF-8'
tree = html.fromstring(res.text)
title = tree.xpath('//title/text()')[0].split(' ', 1)[1]
row[1] = title
codePath = get_code_dir(chapter+'/ ', numberStr)
row[2] = f"[](http://boj.kr/{numberStr})"
if codePath:
row[3] = f'[](https://github.com/rhs0266/FastCampus/tree/main/%EA%B0%95%EC%9D%98%20%EC%9E%90%EB%A3%8C/02-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98/{codePath})'
else:
if len(row[3]) < 10:
row[3] = f'[]'
new_md.append('|'.join(row))
with open(md_path, "w", encoding="UTF8") as f:
f.write('\n'.join(new_md))
| 34.854545 | 176 | 0.521127 |
0181665c2fcc24657f6c8b73a95f4034a3a47d28 | 488 | py | Python | CursoEmVideo/Exercicio109.py | LucasAlmeida0/Estudos | ae5b498c0bf3dee94f761a5fe49c77b0e270d483 | [
"MIT"
] | null | null | null | CursoEmVideo/Exercicio109.py | LucasAlmeida0/Estudos | ae5b498c0bf3dee94f761a5fe49c77b0e270d483 | [
"MIT"
] | null | null | null | CursoEmVideo/Exercicio109.py | LucasAlmeida0/Estudos | ae5b498c0bf3dee94f761a5fe49c77b0e270d483 | [
"MIT"
] | null | null | null | from utilidadesCeV import moeda
preco = float(input('Digite o preo: R$'))
porcentagem = float(input('Digite a aliquota:'))
print(f'A metade de {moeda.moeda(preco)} {moeda.metade(preco, True)}')
print(f'O dobro de {moeda.moeda(preco)} {moeda.dobro(preco, True)}')
print(f'Aumentando {moeda.moeda(preco)} em {porcentagem}% temos {moeda.aumentar(preco, porcentagem, True)}')
print(f'Diminuindo {moeda.moeda(preco)} em {porcentagem}% temos {moeda.diminuir(preco, porcentagem, True)}')
| 48.8 | 108 | 0.729508 |