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
fd7a65079d9a251ce00ad45789e94722c4e7ad4e
146
py
Python
cru_alaska_temperature/__init__.py
sc0tts/cruAKtemp
84dbfc424f5f36bb0f0055b5290f0ab2063ae225
[ "MIT" ]
null
null
null
cru_alaska_temperature/__init__.py
sc0tts/cruAKtemp
84dbfc424f5f36bb0f0055b5290f0ab2063ae225
[ "MIT" ]
7
2017-04-25T21:50:47.000Z
2018-03-19T17:39:28.000Z
cru_alaska_temperature/__init__.py
sc0tts/cruAKtemp
84dbfc424f5f36bb0f0055b5290f0ab2063ae225
[ "MIT" ]
2
2019-02-18T22:42:07.000Z
2020-08-31T23:37:17.000Z
from .alaska_temperature import AlaskaTemperature from .bmi import AlaskaTemperatureBMI __all__ = ["AlaskaTemperature", "AlaskaTemperatureBMI"]
24.333333
55
0.835616
fd7b422625225dcfe35545919a8429eaaa584545
378
py
Python
Qualification/1-ForegoneSolution/Solution.py
n1try/codejam-2019
3cedc74915eca7384adaf8f6a68eeb21ada1beaf
[ "MIT" ]
null
null
null
Qualification/1-ForegoneSolution/Solution.py
n1try/codejam-2019
3cedc74915eca7384adaf8f6a68eeb21ada1beaf
[ "MIT" ]
null
null
null
Qualification/1-ForegoneSolution/Solution.py
n1try/codejam-2019
3cedc74915eca7384adaf8f6a68eeb21ada1beaf
[ "MIT" ]
null
null
null
import re t = int(input()) for i in range(0, t): chars = input() m1, m2 = [None] * len(chars), [None] * len(chars) for j in range(0, len(chars)): m1[j] = "3" if chars[j] == "4" else chars[j] m2[j] = "1" if chars[j] == "4" else "0" s1 = ''.join(m1) s2 = ''.join(m2) print("Case #{}: {} {}".format(i + 1, s1, re.sub(r'^0*', '', s2)))
29.076923
70
0.457672
fd7bd590362f7ad441cb4aaacc481be5a9c4d64c
1,645
py
Python
1.imdbData.py
batucimenn/imdbScraperOnWaybackMachine2
e6d92b5c794a2603a05e986b587a796d2a80fd8d
[ "MIT" ]
null
null
null
1.imdbData.py
batucimenn/imdbScraperOnWaybackMachine2
e6d92b5c794a2603a05e986b587a796d2a80fd8d
[ "MIT" ]
null
null
null
1.imdbData.py
batucimenn/imdbScraperOnWaybackMachine2
e6d92b5c794a2603a05e986b587a796d2a80fd8d
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 # Scraper movies data from Imdb # In[ ]: import csv import pandas as pd # Year range to collect data. # In[ ]: startYear=int(input("startYear: ")) finishYear=int(input("finishYear: ")) # File path to save. Ex: C:\Users\User\Desktop\newFile # In[ ]: filePath = input("File path: "+"r'")+("/") # Create csv and set the titles. # In[ ]: with open(filePath+str(startYear)+"_"+str(finishYear)+".csv", mode='w', newline='') as yeni_dosya: yeni_yazici = csv.writer(yeni_dosya, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) yeni_yazici.writerow(['Title'+";"+'Film'+";"+'Year']) yeni_dosya.close() # Download title.basics.tsv.gz from https://datasets.imdbws.com/. Extract data.tsv, print it into csv. # In[ ]: with open("data.tsv",encoding="utf8") as tsvfile: tsvreader = csv.reader(tsvfile, delimiter="\t") for line in tsvreader: try: ceviri=int(line[5]) if(ceviri>=startYear and ceviri<=finishYear and (line[1]=="movie" or line[1]=="tvMovie")): print(line[0]+";"+line[3]+";"+line[5]+";"+line[1]) line0=line[0].replace("\"","") line5=line[5].replace("\"","") with open(filePath+str(startYear)+"_"+str(finishYear)+".csv", mode='a', newline='') as yeni_dosya: yeni_yazici = csv.writer(yeni_dosya, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) yeni_yazici.writerow([line0+";"+line[3]+";"+line5]) yeni_dosya.close() except: pass
26.532258
117
0.570821
fd7c26cf48ae51b52e75c459ca5537852b6f4936
2,680
py
Python
effective_python/metaclass_property/descriptor_demo.py
ftconan/python3
eb63ba33960072f792ecce6db809866b38c402f8
[ "MIT" ]
1
2018-12-19T22:07:56.000Z
2018-12-19T22:07:56.000Z
effective_python/metaclass_property/descriptor_demo.py
ftconan/python3
eb63ba33960072f792ecce6db809866b38c402f8
[ "MIT" ]
12
2020-03-14T05:32:26.000Z
2022-03-12T00:08:49.000Z
effective_python/metaclass_property/descriptor_demo.py
ftconan/python3
eb63ba33960072f792ecce6db809866b38c402f8
[ "MIT" ]
1
2018-12-19T22:08:00.000Z
2018-12-19T22:08:00.000Z
""" @author: magician @file: descriptor_demo.py @date: 2020/1/14 """ from weakref import WeakKeyDictionary # class Exam(object): # """ # Exam # """ # def __init__(self): # self._writing_grade = 0 # self._math_grade = 0 # # @staticmethod # def _check_grade(value): # if not(0 <= value <= 100): # raise ValueError('Grade must be between 0 and 100') # # @property # def writing_grade(self): # return self._writing_grade # # @writing_grade.setter # def writing_grade(self, value): # self._check_grade(value) # self._writing_grade = value # # @property # def math_grade(self): # return self._math_grade # # @math_grade.setter # def math_grade(self, value): # self._check_grade(value) # self._math_grade = value if __name__ == '__main__': galileo = Homework() galileo.grade = 95 # first_exam = Exam() # first_exam.writing_grade = 82 # first_exam.science_grade = 99 # print('Writing', first_exam.writing_grade) # print('Science', first_exam.science_grade) # # second_exam = Exam() # second_exam.writing_grade = 75 # second_exam.science_grade = 99 # print('Second', second_exam.writing_grade, 'is right') # print('First', first_exam.writing_grade, 'is wrong') first_exam = Exam() first_exam.writing_grade = 82 second_exam = Exam() second_exam.writing_grade = 75 print('First ', first_exam.writing_grade, 'is right') print('Second ', second_exam.writing_grade, 'is right')
23.304348
65
0.596642
fd7c5d171d30796fbb3b1df9d4223d6476d4d998
3,584
py
Python
afk-q-babyai/babyai/layers/aggrerator.py
IouJenLiu/AFK
db2b47bb3a5614b61766114b87f143e4a61a4a8d
[ "MIT" ]
1
2022-03-12T03:10:29.000Z
2022-03-12T03:10:29.000Z
afk-q-babyai/babyai/layers/aggrerator.py
IouJenLiu/AFK
db2b47bb3a5614b61766114b87f143e4a61a4a8d
[ "MIT" ]
null
null
null
afk-q-babyai/babyai/layers/aggrerator.py
IouJenLiu/AFK
db2b47bb3a5614b61766114b87f143e4a61a4a8d
[ "MIT" ]
null
null
null
import torch import numpy as np import torch.nn.functional as F def masked_softmax(x, m=None, axis=-1): ''' x: batch x time x hid m: batch x time (optional) ''' x = torch.clamp(x, min=-15.0, max=15.0) if m is not None: m = m.float() x = x * m e_x = torch.exp(x - torch.max(x, dim=axis, keepdim=True)[0]) if m is not None: e_x = e_x * m softmax = e_x / (torch.sum(e_x, dim=axis, keepdim=True) + 1e-6) return softmax
41.195402
103
0.624163
fd816f646c55f1654d9547e1f480c4843279f30e
707
py
Python
analysis_llt/ml/cv/neighbors.py
Tammy-Lee/analysis-llt
ea1bb62d614bb75dac68c010a0cc524a5be185f2
[ "MIT" ]
null
null
null
analysis_llt/ml/cv/neighbors.py
Tammy-Lee/analysis-llt
ea1bb62d614bb75dac68c010a0cc524a5be185f2
[ "MIT" ]
null
null
null
analysis_llt/ml/cv/neighbors.py
Tammy-Lee/analysis-llt
ea1bb62d614bb75dac68c010a0cc524a5be185f2
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ create on 2019-03-20 04:17 author @lilia """ from sklearn.neighbors import KNeighborsClassifier from analysis_llt.ml.cv.base import BaseCV
29.458333
102
0.708628
fd8175ceff7997ec372ad498a63c3ba3b5e8e259
1,066
py
Python
tests/test_oas_cache.py
maykinmedia/zgw-consumers
9b0759d9b7c3590b245004afd4c5e5474785bf91
[ "MIT" ]
2
2021-04-25T11:29:33.000Z
2022-03-08T14:06:58.000Z
tests/test_oas_cache.py
maykinmedia/zgw-consumers
9b0759d9b7c3590b245004afd4c5e5474785bf91
[ "MIT" ]
27
2020-04-01T07:33:02.000Z
2022-03-14T09:11:05.000Z
tests/test_oas_cache.py
maykinmedia/zgw-consumers
9b0759d9b7c3590b245004afd4c5e5474785bf91
[ "MIT" ]
2
2020-07-30T15:40:47.000Z
2020-11-30T10:56:29.000Z
import threading from zds_client.oas import schema_fetcher
21.755102
82
0.684803
fd81f57132ba4b8e36862c9d9eb8179dcba9623a
4,165
py
Python
src/uproot_browser/tree.py
amangoel185/uproot-browser
8181913ac04d0318b05256923d8980d6d3acaa7f
[ "BSD-3-Clause" ]
12
2022-03-18T11:47:26.000Z
2022-03-25T13:57:08.000Z
src/uproot_browser/tree.py
amangoel185/uproot-browser
8181913ac04d0318b05256923d8980d6d3acaa7f
[ "BSD-3-Clause" ]
7
2022-03-18T11:40:36.000Z
2022-03-29T22:15:01.000Z
src/uproot_browser/tree.py
amangoel185/uproot-browser
8181913ac04d0318b05256923d8980d6d3acaa7f
[ "BSD-3-Clause" ]
1
2022-03-21T14:37:07.000Z
2022-03-21T14:37:07.000Z
""" Display tools for TTrees. """ from __future__ import annotations import dataclasses import functools from pathlib import Path from typing import Any, Dict import uproot from rich.console import Console from rich.markup import escape from rich.text import Text from rich.tree import Tree console = Console() __all__ = ("make_tree", "process_item", "print_tree", "UprootItem", "console") def make_tree(node: UprootItem, *, tree: Tree | None = None) -> Tree: """ Given an object, build a rich.tree.Tree output. """ if tree is None: tree = Tree(**node.meta()) else: tree = tree.add(**node.meta()) for child in node.children: make_tree(child, tree=tree) return tree # pylint: disable-next=redefined-outer-name def print_tree(entry: str, *, console: Console = console) -> None: """ Prints a tree given a specification string. Currently, that must be a single filename. Colons are not allowed currently in the filename. """ upfile = uproot.open(entry) tree = make_tree(UprootItem("/", upfile)) console.print(tree)
25.090361
90
0.623049
fd83d8e2ff034305d143f2f77d3ed14a017cf93e
5,256
py
Python
backend/apps/tasks/models.py
HerlanAssis/simple-project-manager
800c833ec0cbeba848264753d79c5ecedc54cc39
[ "MIT" ]
1
2019-06-14T20:34:19.000Z
2019-06-14T20:34:19.000Z
backend/apps/tasks/models.py
HerlanAssis/simple-project-manager
800c833ec0cbeba848264753d79c5ecedc54cc39
[ "MIT" ]
3
2020-02-11T23:42:20.000Z
2020-06-25T17:35:48.000Z
backend/apps/tasks/models.py
HerlanAssis/simple-project-manager
800c833ec0cbeba848264753d79c5ecedc54cc39
[ "MIT" ]
null
null
null
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from apps.core.models import BaseModel from apps.core.utils import HASH_MAX_LENGTH, create_hash, truncate from django.utils.encoding import python_2_unicode_compatible from django.utils import timezone from django.db.models import F import datetime TODO = 'TODO' DOING = 'DOING' BLOCKED = 'BLOCKED' DONE = 'DONE' PROGRESS = ( (TODO, 'To Do'), (DOING, 'Doing'), (BLOCKED, 'Blocked'), (DONE, 'Done'), ) # method for updating
30.917647
145
0.68398
fd84a04d43460db0ba028f9e178dd3ce7cffe504
2,650
py
Python
eland/tests/dataframe/test_aggs_pytest.py
redNixon/eland
1b9cb1db6d30f0662fe3679c7bb31e2c0865f0c3
[ "Apache-2.0" ]
null
null
null
eland/tests/dataframe/test_aggs_pytest.py
redNixon/eland
1b9cb1db6d30f0662fe3679c7bb31e2c0865f0c3
[ "Apache-2.0" ]
null
null
null
eland/tests/dataframe/test_aggs_pytest.py
redNixon/eland
1b9cb1db6d30f0662fe3679c7bb31e2c0865f0c3
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Elasticsearch BV # # 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. # File called _pytest for PyCharm compatability import numpy as np from pandas.util.testing import assert_almost_equal from eland.tests.common import TestData
37.323944
86
0.672075
fd8681cae85c92327aba29d9f6d3628698abb698
1,811
py
Python
frootspi_examples/launch/conductor.launch.py
SSL-Roots/FrootsPi
3aff59342a9d3254d8b089b66aeeed59bcb66c7b
[ "Apache-2.0" ]
2
2021-11-27T10:57:01.000Z
2021-11-27T11:25:52.000Z
frootspi_examples/launch/conductor.launch.py
SSL-Roots/FrootsPi
3aff59342a9d3254d8b089b66aeeed59bcb66c7b
[ "Apache-2.0" ]
1
2018-07-31T13:29:57.000Z
2018-07-31T13:36:50.000Z
frootspi_examples/launch/conductor.launch.py
SSL-Roots/FrootsPi
3aff59342a9d3254d8b089b66aeeed59bcb66c7b
[ "Apache-2.0" ]
null
null
null
# Copyright 2021 Roots # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from launch import LaunchDescription from launch.actions import DeclareLaunchArgument from launch.substitutions import LaunchConfiguration from launch_ros.actions import ComposableNodeContainer from launch_ros.actions import PushRosNamespace from launch_ros.descriptions import ComposableNode
34.826923
81
0.703479
fd876869a60981b01094fa1c90ddae1cb851c885
1,639
py
Python
src/vnf/l23filter/controllers/InitializeDbController.py
shield-h2020/vnsfs
864bdd418d3910b86783044be94d2bdb07e95aec
[ "Apache-2.0" ]
2
2018-11-06T17:55:56.000Z
2021-02-09T07:40:17.000Z
src/vnf/l23filter/controllers/InitializeDbController.py
shield-h2020/vnsfs
864bdd418d3910b86783044be94d2bdb07e95aec
[ "Apache-2.0" ]
null
null
null
src/vnf/l23filter/controllers/InitializeDbController.py
shield-h2020/vnsfs
864bdd418d3910b86783044be94d2bdb07e95aec
[ "Apache-2.0" ]
4
2018-03-28T18:06:26.000Z
2021-07-17T00:33:55.000Z
import logging from sqlalchemy import create_engine, event from configuration import config as cnf from helpers.DbHelper import on_connect, db_session, assert_database_type from models import Base, Flow # from models.depreciated import Metric logging.basicConfig() logging.getLogger('sqlalchemy.engine').setLevel(logging.ERROR)
26.015873
73
0.649786
fd88ba06d62178ae22d727dfd3879ac3e980173e
166
py
Python
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_1_Npercent.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
null
null
null
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_1_Npercent.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
null
null
null
tests/web_platform/css_flexbox_1/test_flexbox_flex_1_1_Npercent.py
fletchgraham/colosseum
77be4896ee52b8f5956a3d77b5f2ccd2c8608e8f
[ "BSD-3-Clause" ]
1
2020-01-16T01:56:41.000Z
2020-01-16T01:56:41.000Z
from tests.utils import W3CTestCase
27.666667
80
0.807229
fd88c78266fc4209a289fbc25268f76bce338838
150
py
Python
frontends/python/tests/analysis/constant_attribute.py
aardwolf-sfl/aardwolf
33bfe3e0649a73aec7efa0fa80bff8077b550bd0
[ "MIT" ]
2
2020-08-15T08:55:39.000Z
2020-11-09T17:31:16.000Z
frontends/python/tests/analysis/constant_attribute.py
aardwolf-sfl/aardwolf
33bfe3e0649a73aec7efa0fa80bff8077b550bd0
[ "MIT" ]
null
null
null
frontends/python/tests/analysis/constant_attribute.py
aardwolf-sfl/aardwolf
33bfe3e0649a73aec7efa0fa80bff8077b550bd0
[ "MIT" ]
null
null
null
# AARD: function: __main__ # AARD: #1:1 -> :: defs: %1 / uses: [@1 4:1-4:22] { call } 'value: {}'.format(3) # AARD: @1 = constant_attribute.py
21.428571
63
0.546667
fd88d6da1a9e31351274cdc8c9d06c97bd2fa421
884
py
Python
rl_server/tensorflow/networks/layer_norm.py
parilo/tars-rl
17595905a0d1bdc90fe3d8f793acb60de96ea897
[ "MIT" ]
9
2019-03-11T11:02:12.000Z
2022-03-10T12:53:25.000Z
rl_server/tensorflow/networks/layer_norm.py
parilo/tars-rl
17595905a0d1bdc90fe3d8f793acb60de96ea897
[ "MIT" ]
1
2021-01-06T20:18:33.000Z
2021-01-06T20:19:53.000Z
rl_server/tensorflow/networks/layer_norm.py
parilo/tars-rl
17595905a0d1bdc90fe3d8f793acb60de96ea897
[ "MIT" ]
3
2019-01-19T03:32:26.000Z
2020-11-29T18:15:57.000Z
from tensorflow.python.keras.layers import Layer from tensorflow.python.keras import backend as K
34
90
0.645928
fd89a08e7b302e42c7342a9d210047fac1b9c3fb
3,399
py
Python
hasdrubal/visitors/type_var_resolver.py
Armani-T/hasdrubal
7fac381b866114533e589e964ec7c27adbd1deff
[ "MIT" ]
2
2021-06-25T15:46:16.000Z
2022-02-20T22:04:36.000Z
hasdrubal/visitors/type_var_resolver.py
Armani-T/hasdrubal
7fac381b866114533e589e964ec7c27adbd1deff
[ "MIT" ]
42
2021-07-06T05:38:23.000Z
2022-03-04T18:09:30.000Z
hasdrubal/visitors/type_var_resolver.py
Armani-T/hasdrubal
7fac381b866114533e589e964ec7c27adbd1deff
[ "MIT" ]
null
null
null
from typing import Container from asts.typed import Name as TypedName from asts import base, visitor, types_ as types PREDEFINED_TYPES: Container[str] = ( ",", "->", "Bool", "Float", "Int", "List", "String", "Unit", ) def resolve_type_vars( node: base.ASTNode, defined_types: Container[str] = PREDEFINED_TYPES, ) -> base.ASTNode: """ Convert `TypeName`s in the AST to `TypeVar`s using `defined_types` to determine which ones should be converted. Parameters ---------- node: ASTNode The AST where `TypeName`s will be searched for. defined_types: Container[str] = PREDEFINED_TYPES If a `TypeName` is inside this, it will remain a `TypeName`. Returns ------- ASTNode The AST but with the appropriate `TypeName`s converted to `TypeVar`s. """ resolver = TypeVarResolver(defined_types) return resolver.run(node)
31.183486
86
0.626655
fd8a5381cdea04589d3919c507d39969d9014954
3,533
py
Python
cdist/plugin.py
acerv/pytest-cdist
24a3f0987c3bc2821b91374c93d6b1303a7aca81
[ "MIT" ]
null
null
null
cdist/plugin.py
acerv/pytest-cdist
24a3f0987c3bc2821b91374c93d6b1303a7aca81
[ "MIT" ]
null
null
null
cdist/plugin.py
acerv/pytest-cdist
24a3f0987c3bc2821b91374c93d6b1303a7aca81
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ cdist-plugin implementation. Author: Andrea Cervesato <andrea.cervesato@mailbox.org> """ import pytest from cdist import __version__ from cdist.redis import RedisResource from cdist.resource import ResourceError def pytest_addoption(parser): """ Plugin configurations. """ parser.addini( "cdist_hostname", "cdist resource hostname (default: localhost)", default="localhost" ) parser.addini( "cdist_port", "cdist resource port (default: 6379)", default="6379" ) parser.addini( "cdist_autolock", "Enable/Disable configuration automatic lock (default: True)", default="True" ) group = parser.getgroup("cdist") group.addoption( "--cdist-config", action="store", dest="cdist_config", default="", help="configuration key name" ) def pytest_configure(config): """ Print out some session informations. """ config.pluginmanager.register(Plugin(), "plugin.cdist")
26.765152
85
0.601472
fd8a85c0cecb1f0067a9c558a9299006820a9bf0
2,851
py
Python
superironic/utils.py
jimrollenhagen/superironic
45f8c50a881a0728c3d86e0783f9ee6baa47559d
[ "Apache-2.0" ]
null
null
null
superironic/utils.py
jimrollenhagen/superironic
45f8c50a881a0728c3d86e0783f9ee6baa47559d
[ "Apache-2.0" ]
null
null
null
superironic/utils.py
jimrollenhagen/superironic
45f8c50a881a0728c3d86e0783f9ee6baa47559d
[ "Apache-2.0" ]
null
null
null
# Copyright 2015 Rackspace, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from superironic import colors from superironic import config def get_envs_in_group(group_name): """ Takes a group_name and finds any environments that have a SUPERIRONIC_GROUP configuration line that matches the group_name. """ envs = [] for section in config.ironic_creds.sections(): if (config.ironic_creds.has_option(section, 'SUPERIRONIC_GROUP') and config.ironic_creds.get(section, 'SUPERIRONIC_GROUP') == group_name): envs.append(section) return envs def is_valid_environment(env): """Check if config file contains `env`.""" valid_envs = config.ironic_creds.sections() return env in valid_envs def is_valid_group(group_name): """ Checks to see if the configuration file contains a SUPERIRONIC_GROUP configuration option. """ valid_groups = [] for section in config.ironic_creds.sections(): if config.ironic_creds.has_option(section, 'SUPERIRONIC_GROUP'): valid_groups.append(config.ironic_creds.get(section, 'SUPERIRONIC_GROUP')) valid_groups = list(set(valid_groups)) if group_name in valid_groups: return True else: return False def print_valid_envs(valid_envs): """Prints the available environments.""" print("[%s] Your valid environments are:" % (colors.gwrap('Found environments'))) print("%r" % valid_envs) def warn_missing_ironic_args(): """Warn user about missing Ironic arguments.""" msg = """ [%s] No arguments were provided to pass along to ironic. The superironic script expects to get commands structured like this: superironic [environment] [command] Here are some example commands that may help you get started: superironic prod node-list superironic prod node-show superironic prod port-list """ print(msg % colors.rwrap('Missing arguments')) def rm_prefix(name): """ Removes ironic_ os_ ironicclient_ prefix from string. """ if name.startswith('ironic_'): return name[7:] elif name.startswith('ironicclient_'): return name[13:] elif name.startswith('os_'): return name[3:] else: return name
30.98913
79
0.681866
fd8b4419a03211dab8726d274c1ded97471a7d78
1,150
py
Python
cloudshell/huawei/wdm/cli/huawei_cli_handler.py
QualiSystems/cloudshell-huawei-wdm
be359a6bc81fd1644e3cb2a619b7c296a17a2e68
[ "Apache-2.0" ]
null
null
null
cloudshell/huawei/wdm/cli/huawei_cli_handler.py
QualiSystems/cloudshell-huawei-wdm
be359a6bc81fd1644e3cb2a619b7c296a17a2e68
[ "Apache-2.0" ]
1
2021-04-11T18:57:18.000Z
2021-04-11T18:57:18.000Z
cloudshell/huawei/wdm/cli/huawei_cli_handler.py
QualiSystems/cloudshell-huawei-wdm
be359a6bc81fd1644e3cb2a619b7c296a17a2e68
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- from cloudshell.cli.service.cli_service_impl import CliServiceImpl from cloudshell.huawei.cli.huawei_cli_handler import HuaweiCli, HuaweiCliHandler from cloudshell.huawei.wdm.cli.huawei_command_modes import ( WDMConfigCommandMode, WDMEnableCommandMode, )
30.263158
83
0.727826
fd8b6f3ec4c3956c2a4af1d583d22afb4c1f7e8e
1,510
py
Python
pretalx_orcid/migrations/0001_initial.py
pretalx/pretalx-orcid
a10adf5bf5579bd7818db7697d49176114c9714e
[ "Apache-2.0" ]
1
2020-02-07T12:32:15.000Z
2020-02-07T12:32:15.000Z
pretalx_orcid/migrations/0001_initial.py
pretalx/pretalx-orcid
a10adf5bf5579bd7818db7697d49176114c9714e
[ "Apache-2.0" ]
4
2019-11-26T04:02:02.000Z
2022-03-06T02:06:54.000Z
pretalx_orcid/migrations/0001_initial.py
pretalx/pretalx-orcid
a10adf5bf5579bd7818db7697d49176114c9714e
[ "Apache-2.0" ]
null
null
null
# Generated by Django 2.2.7 on 2019-11-20 14:10 from django.conf import settings from django.db import migrations, models import django.db.models.deletion
31.458333
87
0.47947
fd8bcae4d3f693f9766ffc4188aca7183ade4a41
980
py
Python
python/leetcode/401.py
ParkinWu/leetcode
b31312bdefbb2be795f3459e1a76fbc927cab052
[ "MIT" ]
null
null
null
python/leetcode/401.py
ParkinWu/leetcode
b31312bdefbb2be795f3459e1a76fbc927cab052
[ "MIT" ]
null
null
null
python/leetcode/401.py
ParkinWu/leetcode
b31312bdefbb2be795f3459e1a76fbc927cab052
[ "MIT" ]
null
null
null
# 4 LED 0-11 6 LED 0-59 # # LED 0 1 # # # # 3:25 # # n LED # # : # # : n = 1 # : ["1:00", "2:00", "4:00", "8:00", "0:01", "0:02", "0:04", "0:08", "0:16", "0:32"] # # # : # # # 01:00 1:00 # 10:2 10:02 # # # LeetCode # https://leetcode-cn.com/problems/binary-watch # from typing import List if __name__ == '__main__': s = Solution() res = s.numOfBin(4, 2) print(res)
19.6
107
0.542857
fd8bcd859196def3cab1defab94ee20606249351
22,340
py
Python
torchreid/engine/image/classmemoryloss_QA.py
Arindam-1991/deep_reid
ab68d95c2229ef5b832a6a6b614a9b91e4984bd5
[ "MIT" ]
1
2021-03-27T17:27:47.000Z
2021-03-27T17:27:47.000Z
torchreid/engine/image/classmemoryloss_QA.py
Arindam-1991/deep_reid
ab68d95c2229ef5b832a6a6b614a9b91e4984bd5
[ "MIT" ]
null
null
null
torchreid/engine/image/classmemoryloss_QA.py
Arindam-1991/deep_reid
ab68d95c2229ef5b832a6a6b614a9b91e4984bd5
[ "MIT" ]
null
null
null
from __future__ import division, print_function, absolute_import import numpy as np import torch, sys import os.path as osp from torchreid import metrics from torchreid.losses import TripletLoss, CrossEntropyLoss from torchreid.losses import ClassMemoryLoss from ..engine import Engine from ..pretrainer import PreTrainer # Required for new engine run defination import time, datetime from torch import nn from torchreid.utils import ( MetricMeter, AverageMeter, re_ranking, open_all_layers, Logger, open_specified_layers, visualize_ranked_results ) from torch.utils.tensorboard import SummaryWriter from torchreid.utils.serialization import load_checkpoint, save_checkpoint
40.32491
159
0.555237
fd8c2c7eeb82fbf804fe620863dfe2ae2700ad4d
337
py
Python
setup.py
xoolive/cartotools
2d6217fde9dadcdb860603cd4b33814b99ae451e
[ "MIT" ]
3
2018-01-09T10:53:24.000Z
2020-06-04T16:04:52.000Z
setup.py
xoolive/cartotools
2d6217fde9dadcdb860603cd4b33814b99ae451e
[ "MIT" ]
1
2018-12-16T13:49:06.000Z
2019-02-19T20:23:19.000Z
setup.py
xoolive/cartotools
2d6217fde9dadcdb860603cd4b33814b99ae451e
[ "MIT" ]
1
2018-01-09T11:00:39.000Z
2018-01-09T11:00:39.000Z
from setuptools import setup setup( name="cartotools", version="1.2.1", description="Making cartopy suit my needs", license="MIT", packages=[ "cartotools", "cartotools.crs", "cartotools.img_tiles", "cartotools.osm", ], author="Xavier Olive", install_requires=['pandas'] )
19.823529
47
0.596439
fd8d82fd51795634599d592a12414f82293ec386
2,623
py
Python
api/app/tests/weather_models/endpoints/test_models_endpoints.py
bcgov/wps
71df0de72de9cd656dc9ebf8461ffe47cfb155f6
[ "Apache-2.0" ]
19
2020-01-31T21:51:31.000Z
2022-01-07T14:40:03.000Z
api/app/tests/weather_models/endpoints/test_models_endpoints.py
bcgov/wps
71df0de72de9cd656dc9ebf8461ffe47cfb155f6
[ "Apache-2.0" ]
1,680
2020-01-24T23:25:08.000Z
2022-03-31T23:50:27.000Z
api/app/tests/weather_models/endpoints/test_models_endpoints.py
bcgov/wps
71df0de72de9cd656dc9ebf8461ffe47cfb155f6
[ "Apache-2.0" ]
6
2020-04-28T22:41:08.000Z
2021-05-05T18:16:06.000Z
""" Functional testing for /models/* endpoints. """ import os import json import importlib import logging import pytest from pytest_bdd import scenario, given, then, when from fastapi.testclient import TestClient import app.main from app.tests import load_sqlalchemy_response_from_json from app.tests import load_json_file logger = logging.getLogger(__name__) def _patch_function(monkeypatch, module_name: str, function_name: str, json_filename: str): """ Patch module_name.function_name to return de-serialized json_filename """ monkeypatch.setattr(importlib.import_module(module_name), function_name, mock_get_data)
34.973333
110
0.733511
fd8e56403a239049d047cb2ae7cdbf57d5c4d0b6
3,144
py
Python
CLE/Module_DeploymentMonitoring/urls.py
CherBoon/Cloudtopus
41e4b3743d8f5f988373d14937a1ed8dbdf92afb
[ "MIT" ]
3
2019-03-04T02:55:25.000Z
2021-02-13T09:00:52.000Z
CLE/Module_DeploymentMonitoring/urls.py
MartinTeo/Cloudtopus
ebcc57cdf10ca2b73343f03abb33a12ab9c6edef
[ "MIT" ]
6
2019-02-28T08:54:25.000Z
2022-03-02T14:57:04.000Z
CLE/Module_DeploymentMonitoring/urls.py
MartinTeo/Cloudtopus
ebcc57cdf10ca2b73343f03abb33a12ab9c6edef
[ "MIT" ]
2
2019-02-28T08:52:15.000Z
2019-09-24T18:32:01.000Z
from django.contrib import admin from Module_DeploymentMonitoring import views from django.urls import path,re_path urlpatterns = [ path('instructor/ITOperationsLab/setup/awskeys/',views.faculty_Setup_GetAWSKeys,name='itopslab_setup_AWSKeys'), path('instructor/ITOperationsLab/monitor/',views.faculty_Monitor_Base,name='itopslab_monitor'), path('student/ITOperationsLab/deploy/',views.student_Deploy_Base,name='itopslab_studeploy'), path('student/ITOperationsLab/deploy/<str:course_title>/2',views.student_Deploy_Upload,name='itopslab_studeployUpload'), path('student/ITOperationsLab/monitor/',views.student_Monitor_Base,name='itopslab_stumonitor'), # For adding deployment packages into system path('instructor/ITOperationsLab/setup/deployment_package/',views.faculty_Setup_GetGitHubLinks,name='dp_list'), path('instructor/ITOperationsLab/setup/deployment_package/create/', views.faculty_Setup_AddGitHubLinks, name='dp_create'), path('instructor/ITOperationsLab/setup/deployment_package/<str:course_title>/<str:pk>/update/', views.faculty_Setup_UpdateGitHubLinks, name='dp_update'), path('instructor/ITOperationsLab/setup/deployment_package/<str:course_title>/<str:pk>/delete/', views.faculty_Setup_DeleteGitHubLinks, name='dp_delete'), path('instructor/ITOperationsLab/setup/deployment_package/<str:course_title>/delete/all/', views.faculty_Setup_DeleteAllGitHubLinks, name='dp_delete_all'), # For retrieving and sharing of AMI path('instructor/ITOperationsLab/setup/',views.faculty_Setup_Base,name='itopslab_setup'), path('instructor/ITOperationsLab/setup/ami/get/',views.faculty_Setup_GetAMI,name='itopslab_setup_AMI_get'), path('instructor/ITOperationsLab/setup/ami/accounts/get/',views.faculty_Setup_GetAMIAccounts,name='itopslab_setup_AMI_Accounts_get'), path('instructor/ITOperationsLab/setup/ami/accounts/share/',views.faculty_Setup_ShareAMI,name='itopslab_setup_AMI_Accounts_share'), # For standard student deployment page path('student/ITOperationsLab/deploy/standard/',views.student_Deploy_Standard_Base,name='itopslab_studeploy_standard'), path('student/ITOperationsLab/deploy/standard/deployment_package/',views.student_Deploy_Standard_GetDeploymentPackages,name='dp_list_student'), path('student/ITOperationsLab/deploy/standard/account/',views.student_Deploy_Standard_AddAccount,name='itopslab_studeploy_standard_AddAccount'), path('student/ITOperationsLab/deploy/standard/server/',views.student_Deploy_Standard_GetIPs,name='server_list'), path('student/ITOperationsLab/deploy/standard/server/create/',views.student_Deploy_Standard_AddIPs,name='server_create'), path('student/ITOperationsLab/deploy/standard/server/<str:course_title>/<str:pk>/update/',views.student_Deploy_Standard_UpdateIPs,name='server_update'), path('student/ITOperationsLab/deploy/standard/server/<str:course_title>/<str:pk>/delete/',views.student_Deploy_Standard_DeleteIPs,name='server_delete'), path('student/ITOperationsLab/deploy/standard/server/<str:course_title>/delete/all/',views.student_Deploy_Standard_DeleteAllIPs,name='server_delete_all'), ]
89.828571
159
0.818702
fd8eaa1dd13d7842905f05439abe0c727ac76666
2,918
py
Python
30-Days-of-Python-master/practice_day_9/alpha_day_9/akash_prank.py
vimm0/python_exercise
7773d95b4c25b82a9d014f7a814ac83df9ebac17
[ "MIT" ]
null
null
null
30-Days-of-Python-master/practice_day_9/alpha_day_9/akash_prank.py
vimm0/python_exercise
7773d95b4c25b82a9d014f7a814ac83df9ebac17
[ "MIT" ]
null
null
null
30-Days-of-Python-master/practice_day_9/alpha_day_9/akash_prank.py
vimm0/python_exercise
7773d95b4c25b82a9d014f7a814ac83df9ebac17
[ "MIT" ]
1
2018-01-04T16:27:31.000Z
2018-01-04T16:27:31.000Z
if __name__=="__main__": obj=Akash() obj.question_answer()
35.156627
119
0.186429
fd93406451b3b5dc2f87a2b2dbd3aa123abc1eb6
1,312
py
Python
mainapp/models/user_alert.py
cyroxx/meine-stadt-transparent
d5a3f03a29a1bb97ce50ac5257d8bbd5208d9218
[ "MIT" ]
34
2017-10-04T14:20:41.000Z
2022-03-11T18:06:48.000Z
mainapp/models/user_alert.py
cyroxx/meine-stadt-transparent
d5a3f03a29a1bb97ce50ac5257d8bbd5208d9218
[ "MIT" ]
588
2017-10-14T18:31:17.000Z
2022-03-16T13:00:30.000Z
mainapp/models/user_alert.py
codeformuenster/meine-stadt-transparent
1458bc6acad40183908e2b7cc98ef92165d1123a
[ "MIT" ]
11
2017-11-27T10:12:59.000Z
2022-02-09T10:27:11.000Z
from django.contrib.auth.models import User from django.db import models from mainapp.functions.search import params_to_search_string, search_string_to_params from mainapp.functions.search_notification_tools import ( params_to_human_string, params_are_equal, )
32
85
0.717988
fd944074d8e83c269f766de8fed07825db678f3d
8,123
py
Python
COT/helpers/tests/test_fatdisk.py
morneaup/cot
3d4dc7079a33aa0c09216ec339b44f84ab69ff4b
[ "MIT" ]
81
2015-01-18T22:31:42.000Z
2022-03-14T12:34:33.000Z
COT/helpers/tests/test_fatdisk.py
morneaup/cot
3d4dc7079a33aa0c09216ec339b44f84ab69ff4b
[ "MIT" ]
67
2015-01-05T15:24:39.000Z
2021-08-16T12:44:58.000Z
COT/helpers/tests/test_fatdisk.py
morneaup/cot
3d4dc7079a33aa0c09216ec339b44f84ab69ff4b
[ "MIT" ]
20
2015-07-09T14:20:25.000Z
2021-09-18T17:59:57.000Z
#!/usr/bin/env python # # fatdisk.py - Unit test cases for COT.helpers.fatdisk submodule. # # March 2015, Glenn F. Matthews # Copyright (c) 2014-2017 the COT project developers. # See the COPYRIGHT.txt file at the top-level directory of this distribution # and at https://github.com/glennmatthews/cot/blob/master/COPYRIGHT.txt. # # This file is part of the Common OVF Tool (COT) project. # It is subject to the license terms in the LICENSE.txt file found in the # top-level directory of this distribution and at # https://github.com/glennmatthews/cot/blob/master/LICENSE.txt. No part # of COT, including this file, may be copied, modified, propagated, or # distributed except according to the terms contained in the LICENSE.txt file. """Unit test cases for the COT.helpers.fatdisk module.""" import os import re from distutils.version import StrictVersion import mock from COT.helpers.tests.test_helper import HelperTestCase from COT.helpers.fatdisk import FatDisk from COT.helpers import helpers # pylint: disable=missing-type-doc,missing-param-doc,protected-access
40.014778
79
0.596331
fd969867a45418ad24a3e7bb303872fc31aae097
541
py
Python
scripts/set_left_arm2static_pose.py
birlrobotics/birl_kitting_experiment
75cf42b6fd187b12e99b0e916c73058f429a556c
[ "BSD-3-Clause" ]
2
2019-06-03T03:33:50.000Z
2019-12-30T05:43:34.000Z
scripts/set_left_arm2static_pose.py
birlrobotics/birl_kitting_experiment
75cf42b6fd187b12e99b0e916c73058f429a556c
[ "BSD-3-Clause" ]
null
null
null
scripts/set_left_arm2static_pose.py
birlrobotics/birl_kitting_experiment
75cf42b6fd187b12e99b0e916c73058f429a556c
[ "BSD-3-Clause" ]
1
2019-12-30T05:43:35.000Z
2019-12-30T05:43:35.000Z
#!/usr/bin/env python import baxter_interface import rospy if __name__ == '__main__': rospy.init_node("set_left_arm_py") names = ['left_e0', 'left_e1', 'left_s0', 'left_s1', 'left_w0', 'left_w1', 'left_w2'] joints = [-0.8022719520640714, 1.7184419776286348, 0.21399031991001521, 0.324436936637765, 2.5862916083748075, -0.5825292041994858, -0.3566505331833587] combined = zip(names, joints) command = dict(combined) left = baxter_interface.Limb('left') left.move_to_joint_positions(command) print "Done"
28.473684
156
0.713494
fd97704e53ec2a3a2b53ad0c5d0eef703c39868d
4,414
py
Python
python/SessionCallbackPLSQL.py
synetcom/oracle-db-examples
e995ca265b93c0d6b7da9ad617994288b3a19a2c
[ "Apache-2.0" ]
4
2019-10-26T06:21:32.000Z
2021-02-15T15:28:02.000Z
python/SessionCallbackPLSQL.py
synetcom/oracle-db-examples
e995ca265b93c0d6b7da9ad617994288b3a19a2c
[ "Apache-2.0" ]
null
null
null
python/SessionCallbackPLSQL.py
synetcom/oracle-db-examples
e995ca265b93c0d6b7da9ad617994288b3a19a2c
[ "Apache-2.0" ]
5
2019-10-26T06:21:31.000Z
2022-03-10T12:47:13.000Z
#------------------------------------------------------------------------------ # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # SessionCallbackPLSQL.py # # Demonstrate how to use a session callback written in PL/SQL. The callback is # invoked whenever the tag requested by the application does not match the tag # associated with the session in the pool. It should be used to set session # state, so that the application can count on known session state, which allows # the application to reduce the number of round trips to the database. # # The primary advantage to this approach over the equivalent approach shown in # SessionCallback.py is when DRCP is used, as the callback is invoked on the # server and no round trip is required to set state. # # This script requires cx_Oracle 7.1 and higher. #------------------------------------------------------------------------------ from __future__ import print_function import cx_Oracle import SampleEnv # create pool with session callback defined pool = cx_Oracle.SessionPool(SampleEnv.GetMainUser(), SampleEnv.GetMainPassword(), SampleEnv.GetConnectString(), min=2, max=5, increment=1, threaded=True, sessionCallback="pkg_SessionCallback.TheCallback") # truncate table logging calls to PL/SQL session callback conn = pool.acquire() cursor = conn.cursor() cursor.execute("truncate table PLSQLSessionCallbacks") conn.close() # acquire session without specifying a tag; the callback will not be invoked as # a result and no session state will be changed print("(1) acquire session without tag") conn = pool.acquire() cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying a tag; since the session returned has no tag, # the callback will be invoked; session state will be changed and the tag will # be saved when the connection is closed print("(2) acquire session with tag") conn = pool.acquire(tag="NLS_DATE_FORMAT=SIMPLE") cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying the same tag; since a session exists in the pool # with this tag, it will be returned and the callback will not be invoked but # the connection will still have the session state defined previously print("(3) acquire session with same tag") conn = pool.acquire(tag="NLS_DATE_FORMAT=SIMPLE") cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying a different tag; since no session exists in the # pool with this tag, a new session will be returned and the callback will be # invoked; session state will be changed and the tag will be saved when the # connection is closed print("(4) acquire session with different tag") conn = pool.acquire(tag="NLS_DATE_FORMAT=FULL;TIME_ZONE=UTC") cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session, specifying a different tag but also specifying that a # session with any tag can be acquired from the pool; a session with one of the # previously set tags will be returned and the callback will be invoked; # session state will be changed and the tag will be saved when the connection # is closed print("(4) acquire session with different tag but match any also specified") conn = pool.acquire(tag="NLS_DATE_FORMAT=FULL;TIME_ZONE=MST", matchanytag=True) cursor = conn.cursor() cursor.execute("select to_char(current_date) from dual") result, = cursor.fetchone() print("main(): result is", repr(result)) conn.close() # acquire session and display results from PL/SQL session logs conn = pool.acquire() cursor = conn.cursor() cursor.execute(""" select RequestedTag, ActualTag from PLSQLSessionCallbacks order by FixupTimestamp""") print("(5) PL/SQL session callbacks") for requestedTag, actualTag in cursor: print("Requested:", requestedTag, "Actual:", actualTag)
41.641509
79
0.705709
fd9b3eca720cfbb505d3feb4ca4a2f19b87529e1
536
py
Python
mbrl/env/wrappers/gym_jump_wrapper.py
MaxSobolMark/mbrl-lib
bc8ccfe8a56b58d3ce5bae2c4ccdadd82ecdb594
[ "MIT" ]
null
null
null
mbrl/env/wrappers/gym_jump_wrapper.py
MaxSobolMark/mbrl-lib
bc8ccfe8a56b58d3ce5bae2c4ccdadd82ecdb594
[ "MIT" ]
null
null
null
mbrl/env/wrappers/gym_jump_wrapper.py
MaxSobolMark/mbrl-lib
bc8ccfe8a56b58d3ce5bae2c4ccdadd82ecdb594
[ "MIT" ]
null
null
null
"""Reward wrapper that gives rewards for positive change in z axis. Based on MOPO: https://arxiv.org/abs/2005.13239""" from gym import Wrapper
31.529412
67
0.654851
fd9b964182281e0d8725c664433f2162b4f057ea
2,102
py
Python
img.py
svh2811/Advanced-Lane-Finding
f451f26ef126efcbef711e8c4a14d28d24b08262
[ "MIT" ]
null
null
null
img.py
svh2811/Advanced-Lane-Finding
f451f26ef126efcbef711e8c4a14d28d24b08262
[ "MIT" ]
null
null
null
img.py
svh2811/Advanced-Lane-Finding
f451f26ef126efcbef711e8c4a14d28d24b08262
[ "MIT" ]
null
null
null
import matplotlib.pyplot as plt import numpy as np import cv2 from thresholding import * # list of lists img = cv2.imread("challenge_video_frames/02.jpg") #""" colorspace1 = cv2.cvtColor(img, cv2.COLOR_BGR2Luv) channels1 = [ ("L", colorspace1[:, :, 0]), ("u", colorspace1[:, :, 1]), ("v", colorspace1[:, :, 2]) ] #""" """ colorspace2 = cv2.cvtColor(img, cv2.COLOR_BGR2Lab) channels2 = [ ("L", colorspace2[:, :, 0]), ("a", colorspace2[:, :, 1]), ("b", colorspace2[:, :, 2]) ] colorspace3 = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) channels3 = [ ("H", colorspace3[:, :, 0]), ("S", colorspace3[:, :, 1]), ("V", colorspace3[:, :, 2]) ] colorspace4 = cv2.cvtColor(img, cv2.COLOR_BGR2HLS) channels4 = [ ("H", colorspace4[:, :, 0]), ("L", colorspace4[:, :, 1]), ("S", colorspace4[:, :, 2]) ] """ rgb_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) gradx = gradient_thresh(rgb_img, orient="x", sobel_kernel=7, thresh=(8, 16)) grady = gradient_thresh(rgb_img, orient="y", sobel_kernel=3, thresh=(20, 100)) sobel_grads = [ ("gray", cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)), ("gX", gradx), ("gY", grady) ] mag_thresh_img = mag_thresh(rgb_img, sobel_kernel=3, mag_thresh=(20, 200)) mean_gX = cv2.medianBlur(gradx, 5) dir_thresh_img = dir_threshold(rgb_img, sobel_kernel=3, thresh=(np.pi/2, 2*np.pi/3)) others = [ ("Og Img", rgb_img), ("mag", mag_thresh_img), ("mean_gx", mean_gX) ] plot_images_along_row([others, channels1, sobel_grads]) #plot_images_along_row([channels1, channels2, channels3, channels4])
22.602151
84
0.597526
fd9c0ebbfa6af60ce30b95d414b6de4fd9d68823
479
py
Python
api/utils/signal_hup.py
AutoCoinDCF/NEW_API
f4abc48fff907a0785372b941afcd67e62eec825
[ "Apache-2.0" ]
null
null
null
api/utils/signal_hup.py
AutoCoinDCF/NEW_API
f4abc48fff907a0785372b941afcd67e62eec825
[ "Apache-2.0" ]
null
null
null
api/utils/signal_hup.py
AutoCoinDCF/NEW_API
f4abc48fff907a0785372b941afcd67e62eec825
[ "Apache-2.0" ]
null
null
null
import signal import ConfigParser # HUP signal.signal(signal.SIGHUP, update_config) # ctrl+c signal.signal(signal.SIGINT, ctrl_c) print("test signal") get_config() while True: pass
14.96875
43
0.682672
fd9c7ab39a034416b3b55dc333af7b177eebd1ee
5,602
py
Python
disease_predictor_backend/disease_prediction.py
waizshahid/Disease-Predictor
2bf2e69631ddbf7ffce0b6c39adcb6816d4208b2
[ "MIT" ]
null
null
null
disease_predictor_backend/disease_prediction.py
waizshahid/Disease-Predictor
2bf2e69631ddbf7ffce0b6c39adcb6816d4208b2
[ "MIT" ]
7
2020-09-07T21:31:50.000Z
2022-02-26T22:28:30.000Z
disease_predictor_backend/disease_prediction.py
waizshahid/Disease-Predictor
2bf2e69631ddbf7ffce0b6c39adcb6816d4208b2
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 # In[ ]: import flask from flask import request, jsonify import time import sqlite3 import random # import the necessary packages from keras.preprocessing.image import img_to_array from keras.models import load_model from keras import backend from imutils import build_montages import cv2 import numpy as np from flask_cors import CORS import io app = flask.Flask(__name__) CORS(app) conn = sqlite3.connect('database.db') print("Opened database successfully") conn.execute('CREATE TABLE IF NOT EXISTS Patients (id INTEGER PRIMARY KEY,firstName TEXT, lastName TEXT, ins_ID TEXT, city TEXT, dob TEXT)') conn.execute('CREATE TABLE IF NOT EXISTS Spiral (id INTEGER PRIMARY KEY,positive INTEGER, negative INTEGER)') conn.execute('CREATE TABLE IF NOT EXISTS Wave (id INTEGER PRIMARY KEY,positive INTEGER, negative INTEGER)') conn.execute('CREATE TABLE IF NOT EXISTS Malaria (id INTEGER PRIMARY KEY,positive INTEGER, negative INTEGER)') app.run() # In[ ]:
30.950276
141
0.632453
fd9d4c56c77881ca620b8d3d69d3ef8f45c56824
1,917
py
Python
core/views.py
georgeo23/fika_backend
bff76f3be8bb4af7499bb17127b96b4d4aca14e1
[ "MIT" ]
null
null
null
core/views.py
georgeo23/fika_backend
bff76f3be8bb4af7499bb17127b96b4d4aca14e1
[ "MIT" ]
null
null
null
core/views.py
georgeo23/fika_backend
bff76f3be8bb4af7499bb17127b96b4d4aca14e1
[ "MIT" ]
null
null
null
from django.shortcuts import render from django.http import HttpResponseRedirect from django.contrib.auth.models import User from rest_framework import permissions, status from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework.views import APIView from .serializers import UserSerializer, UserSerializerWithToken, MessageSerializer from core.models import Message from rest_framework import viewsets
32.491525
83
0.7277
fd9dfebdc3992ce7b8a849f7cc5d3d65ff09d8f0
352
py
Python
src/tweetvalidator/data_processing/__init__.py
JoshuaGRubin/AI-Tweet-Validator
c011b08163cfd322c637c2296dab7ae41a64ae71
[ "MIT" ]
5
2019-06-27T02:18:08.000Z
2020-03-09T22:03:09.000Z
src/tweetvalidator/data_processing/__init__.py
JoshuaGRubin/AI-Tweet-Validator
c011b08163cfd322c637c2296dab7ae41a64ae71
[ "MIT" ]
11
2020-01-28T22:50:34.000Z
2022-02-10T00:31:21.000Z
src/tweetvalidator/data_processing/__init__.py
JoshuaGRubin/AI-Text-Validator
c011b08163cfd322c637c2296dab7ae41a64ae71
[ "MIT" ]
1
2020-02-21T03:38:12.000Z
2020-02-21T03:38:12.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from .filter_tweets import filter_tweets_from_directories from .filter_tweets import filter_tweets_from_files from .download_tweets import get_tweets_by_user from .embed_tweets import SentenceEncoder from .embed_tweets import embed_tweets_from_file from .embed_tweets import embed_tweets_from_directories
39.111111
57
0.855114
fd9e5a93435223ef2e9839097575d0e44e5ee1f5
2,132
py
Python
portalsdmz/measureTools/models.py
larc-usp/data-transfer-tester
fd94f120961d6016f58247d31b5d04b2f2b2cd07
[ "AFL-2.1" ]
null
null
null
portalsdmz/measureTools/models.py
larc-usp/data-transfer-tester
fd94f120961d6016f58247d31b5d04b2f2b2cd07
[ "AFL-2.1" ]
2
2017-12-13T20:57:34.000Z
2017-12-13T20:57:35.000Z
portalsdmz/measureTools/models.py
larc-usp/data-transfer-tester
fd94f120961d6016f58247d31b5d04b2f2b2cd07
[ "AFL-2.1" ]
null
null
null
from django.db import models from scenarios.models import ScenarioData # Create your models here.
31.352941
66
0.778612
fd9eda7f958b9bb9b2b7af7adc0477c17f9fb5fc
19,230
py
Python
web/app.py
Luzkan/MessengerNotifier
462c6b1a9aa0a29a0dd6b5fc77d0677c61962d5d
[ "Linux-OpenIB" ]
4
2020-06-01T09:01:47.000Z
2021-04-16T20:07:29.000Z
web/app.py
Luzkan/NotifAyy
462c6b1a9aa0a29a0dd6b5fc77d0677c61962d5d
[ "Linux-OpenIB" ]
20
2020-06-05T16:54:36.000Z
2020-06-09T13:25:59.000Z
web/app.py
Luzkan/MessengerNotifier
462c6b1a9aa0a29a0dd6b5fc77d0677c61962d5d
[ "Linux-OpenIB" ]
2
2020-05-07T04:51:00.000Z
2020-05-08T17:52:55.000Z
import logging from flask import Flask, render_template, request, redirect, flash, session, jsonify from flask_sqlalchemy import SQLAlchemy from flask_login import UserMixin, LoginManager, login_user, logout_user from datetime import datetime from passlib.hash import sha256_crypt import msnotifier.bot.siteMonitor as siteMonitor import threading import msnotifier.messenger as messenger app = Flask(__name__) app.config['SECRET_KEY'] = 'xDDDDsupresikretKEy' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///notifayy.db' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) # Login Handling login_manager = LoginManager() login_manager.login_view = 'auth.login' login_manager.init_app(app) # User_ID = Primary Key # ------------------------- # - Database Structure - # ALERT TABLE # +----+-------------+-----------------+-------------------+---------------+---------------+ # | ID | TITLE (str) | PAGE (url) | DATE_ADDED (date) | USER_ID (key) | APPS_ID (key) | # +----+-------------+-----------------+-------------------+---------------+---------------+ # | 1 | My Site | http://site.com | 07.06.2020 | 2 | 4 | # | 2 | (...) | (...) | (...) | (...) | (...) | # +----+-------------+-----------------+-------------------+---------------+---------------+ # > APPS_ID -> Key, which is: Primary Key in APPS Table # > USER_ID -> Key, which is: Primary Key in USER Table # APPS TABLE # +----+----------------+-----------------+------------------+--------------+ # | ID | Discord (bool) | Telegram (bool) | Messenger (bool) | Email (bool) | # +----+----------------+-----------------+------------------+--------------+ # | 4 | true | false | true | true | # | 5 | (...) | (...) | (...) | (...) | # +----+----------------+-----------------+------------------+--------------+ # > ID -> Primary Key, which is: Referenced by ALERTS TABLE (APPS_ID) # USER TABLE # +----+----------------+-----------------------+------------------+--------------------+--------------+ # | ID | Email (str) | Passowrd (str hashed) | Discord_Id (int) | Messenger_Id (str) | Logged (int) | # +----+----------------+-----------------------+------------------+--------------------+--------------+ # | 2 | cool@gmail.com | <hash> | 21842147 | ??? | 1 | # | 3 | (...) | (...) | (...) | (...) | | # +----+----------------+-----------------------+------------------+--------------------+--------------+ # > ID -> Primary Key, which is: Referenced by ALERTS TABLE (USER_ID) # ------------------------------- # - Database Classes Tables - class Alert(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) page = db.Column(db.String(100), nullable=False) date_added = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) user_id = db.Column(db.Integer, nullable=False) apps_id = db.Column(db.Integer, nullable=False) class ChangesForDiscord(db.Model): id = db.Column(db.Integer, primary_key=True) alert_id = db.Column(db.Integer, nullable=False) content = db.Column(db.String(200), nullable=False) class Apps(db.Model): id = db.Column(db.Integer, primary_key=True) discord = db.Column(db.Boolean, nullable=False, default=False) telegram = db.Column(db.Boolean, nullable=False, default=False) messenger = db.Column(db.Boolean, nullable=False, default=False) email = db.Column(db.Boolean, nullable=False, default=False) class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(100), unique=True) password = db.Column(db.String(100)) discord_id = db.Column(db.Integer, nullable=True) messenger_l = db.Column(db.String(100), nullable=True) messenger_token = db.Column(db.String(100), nullable=True) telegram_id = db.Column(db.String(100), nullable=True) logged = db.Column(db.Integer, nullable=True) def get_items_for_messaging(id): a=Alert.query.filter_by(id=id).first() u=User.query.filter_by(id=a.user_id) bools=Apps.query.filter_by(id=id) return [a,u,bools] def add_to_changes(item): item=ChangesForDiscord(alert_id=item[0],content=item[1]) db.session.add(item) db.session.commit() # -------------------------------- # - Helping Functions for DB - o=Detecting() o.start() # --------------------------------------- # - Helping Functions for Site Walk - # ----------------------- # - Main HREF Routes - # -------------------------------- # - Editing / Deleting Alerts - # Made the alert editing very smooth - everything is handled from mainpage # ----------------------------------------- # - Linking Discord/Messenger/Telegram - # ------------------------------------ # - HREF for Mainpage and Logout - if __name__ == "__main__": app.run(debug=True) # ===== Notice Info 04-06-2020 # First of all, password encryption was added, so: # > pip install passlib (507kb, guys) # # Keep in mind that expanding on existing models in DB # Will caues error due to unexisting columns, so: # Navigate to ./web (here's the app.py) # > python # > from app import db # > db.reflect() # > db.drop_all() # > db.create_all() # ===== Notice Info 05-06-2020 # To surprass all these annoying false-positive warnings with # db.* and logger.*, just do this: # > pip install pylint-flask (10 KB) # Then in .vscode/settings.json (if you are using vscode), add: # > "python.linting.pylintArgs": ["--load-plugins", "pylint-flask"] # ===== Notice Info 06-06-2020 # > app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # ^ This is for the FSADeprecationWarning (adds significant overhead) # and will be disabled by default in the future anyway # # Cleaned up this code a bit, and made it more visual and easy to read # Added linking functionality for all buttons, so you can do w/e you want # with them right now. Also added email bool for alerts
36.768642
168
0.5974
fd9edbd2527ab031760844081c4c8a7d476ee612
2,344
py
Python
src/tcp/registration/pygame_labeler.py
Iszhanghailun/Traffic_Camera_Pipeline
4dbd0e993087d46066a780f5345c125f47b28881
[ "MIT" ]
5
2019-04-04T17:30:41.000Z
2021-12-06T15:27:43.000Z
src/tcp/registration/pygame_labeler.py
Iszhanghailun/Traffic_Camera_Pipeline
4dbd0e993087d46066a780f5345c125f47b28881
[ "MIT" ]
2
2018-02-07T06:22:08.000Z
2020-04-20T06:54:52.000Z
src/tcp/registration/pygame_labeler.py
Iszhanghailun/Traffic_Camera_Pipeline
4dbd0e993087d46066a780f5345c125f47b28881
[ "MIT" ]
7
2018-02-06T23:23:29.000Z
2020-09-20T14:48:22.000Z
import sys, os import gym import gym_urbandriving as uds import cProfile import time import numpy as np import pickle import skimage.transform import cv2 import IPython import pygame from random import shuffle from gym_urbandriving.agents import KeyboardAgent, AccelAgent, NullAgent, TrafficLightAgent#, RRTAgent from gym_urbandriving.assets import Car, TrafficLight import colorlover as cl
26.942529
103
0.610922
fd9ef32448c7395440ff57be12cda76c221914ac
12,319
py
Python
maccli/service/instance.py
manageacloud/manageacloud-cli
1b7d9d5239f9e51f97d0377d223db0f58ca0ca7c
[ "MIT" ]
6
2015-09-21T09:02:04.000Z
2017-02-08T23:40:18.000Z
maccli/service/instance.py
manageacloud/manageacloud-cli
1b7d9d5239f9e51f97d0377d223db0f58ca0ca7c
[ "MIT" ]
3
2015-11-03T01:44:29.000Z
2016-03-25T08:36:15.000Z
maccli/service/instance.py
manageacloud/manageacloud-cli
1b7d9d5239f9e51f97d0377d223db0f58ca0ca7c
[ "MIT" ]
4
2015-07-06T01:46:13.000Z
2019-01-10T23:08:19.000Z
import os import tempfile import time import urllib import urllib.parse import pexpect import maccli.dao.api_instance import maccli.helper.cmd import maccli.helper.simplecache import maccli.helper.metadata from maccli.helper.exception import InstanceDoesNotExistException, InstanceNotReadyException def list_instances(name_or_ids=None): """ List available instances in the account """ instances = [] instances_raw = maccli.dao.api_instance.get_list() if name_or_ids is not None: # if name_or_ids is string, convert to list if isinstance(name_or_ids, str): name_or_ids = [name_or_ids] for instance_raw in instances_raw: if instance_raw['servername'] in name_or_ids or instance_raw['id'] in name_or_ids: instances.append(instance_raw) else: instances = instances_raw return instances def ssh_interactive_instance(instance_id): """ ssh to an existing instance for an interactive session """ stdout = None instance = maccli.dao.api_instance.credentials(instance_id) # strict host check ssh_params = "" maccli.logger.debug("maccli.strict_host_check: " + str(maccli.disable_strict_host_check)) if maccli.disable_strict_host_check: maccli.logger.debug("SSH String Host Checking disabled") ssh_params = "-o 'StrictHostKeyChecking no'" if instance is not None: if instance['privateKey']: """ Authentication with private key """ fd, path = tempfile.mkstemp() try: with open(path, "wb") as f: f.write(bytes(instance['privateKey'], encoding='utf8')) f.close() command = "ssh %s %s@%s -i %s " % (ssh_params, instance['user'], instance['ip'], f.name) os.system(command) finally: os.close(fd) os.remove(path) else: """ Authentication with password """ command = "ssh %s %s@%s" % (ssh_params, instance['user'], instance['ip']) child = pexpect.spawn(command) (rows, cols) = gettermsize() child.setwinsize(rows, cols) # set the child to the size of the user's term i = child.expect(['.* password:', "yes/no", '[#\$] '], timeout=60) if i == 0: child.sendline(instance['password']) child.interact() elif i == 1: child.sendline("yes") child.expect('.* password:', timeout=60) child.sendline(instance['password']) child.interact() elif i == 2: child.sendline("\n") child.interact() return stdout def gettermsize(): """ horrible non-portable hack to get the terminal size to transmit to the child process spawned by pexpect """ (rows, cols) = os.popen("stty size").read().split() # works on Mac OS X, YMMV rows = int(rows) cols = int(cols) return rows, cols def create_instance(cookbook_tag, bootstrap, deployment, location, servername, provider, release, release_version, branch, hardware, lifespan, environments, hd, port, net, metadata=None, applyChanges=True): """ List available instances in the account """ return maccli.dao.api_instance.create(cookbook_tag, bootstrap, deployment, location, servername, provider, release, release_version, branch, hardware, lifespan, environments, hd, port, net, metadata, applyChanges) def destroy_instance(instanceid): """ Destroy the server :param servername: :return: """ return maccli.dao.api_instance.destroy(instanceid) def credentials(servername, session_id): """ Gets the server credentials: public ip, username, password and private key :param instance_id; :return: """ return maccli.dao.api_instance.credentials(servername, session_id) def facts(instance_id): """ Returns facts about the system :param instance_id; :return: """ return maccli.dao.api_instance.facts(instance_id) def log(instance_id, follow): """ Returns server logs :param instance_id; :return: """ if follow: logs = maccli.dao.api_instance.log_follow(instance_id) else: logs = maccli.dao.api_instance.log(instance_id) return logs def lifespan(instance_id, amount): """ Set new instance lifespan :param instance_id; :return: """ return maccli.dao.api_instance.update(instance_id, amount) def update_configuration(cookbook_tag, bootstrap, instance_id, new_metadata=None): """ Update server configuration with given cookbook :param cookbook_tag: :param instance_id: :return: """ return maccli.dao.api_instance.update_configuration(cookbook_tag, bootstrap, instance_id, new_metadata) def create_instances_for_role(root, infrastructure, roles, infrastructure_key, quiet): """ Create all the instances for the given tier """ maccli.logger.debug("Processing infrastructure %s" % infrastructure_key) roles_created = {} maccli.logger.debug("Type role") infrastructure_role = infrastructure['role'] role_raw = roles[infrastructure_role]["instance create"] metadata = maccli.helper.metadata.metadata_instance(root, infrastructure_key, infrastructure_role, role_raw, infrastructure) instances = create_tier(role_raw, infrastructure, metadata, quiet) roles_created[infrastructure_role] = instances return roles_created def create_tier(role, infrastructure, metadata, quiet): """ Creates the instances that represents a role in a given infrastructure :param role: :param infrastructure: :return: """ lifespan = None try: lifespan = infrastructure['lifespan'] except KeyError: pass hardware = "" try: hardware = infrastructure["hardware"] except KeyError: pass environment = maccli.helper.metadata.get_environment(role, infrastructure) hd = None try: hd = role["hd"] except KeyError: pass configuration = None try: configuration = role["configuration"] except KeyError: pass bootstrap = None try: bootstrap = role["bootstrap bash"] except KeyError: pass port = None try: port = infrastructure["port"] except KeyError: pass net = None try: net = infrastructure["net"] except KeyError: pass deployment = None try: deployment = infrastructure["deployment"] except KeyError: pass release = None try: release = infrastructure["release"] except KeyError: pass release_version = None try: release_version = infrastructure["release_version"] except KeyError: pass branch = None try: branch = infrastructure["branch"] except KeyError: pass provider = None try: provider = infrastructure["provider"] except KeyError: pass instances = [] amount = 1 if 'amount' in infrastructure: amount = infrastructure['amount'] for x in range(0, amount): instance = maccli.dao.api_instance.create(configuration, bootstrap, deployment, infrastructure["location"], infrastructure["name"], provider, release, release_version, branch, hardware, lifespan, environment, hd, port, net, metadata, False) instances.append(instance) maccli.logger.info("Creating instance '%s'" % (instance['id'])) return instances
29.973236
119
0.583976
fd9f2efde7a1d0ab6cab653c4c31ffe2c9cae398
5,741
py
Python
odmlui/helpers.py
mpsonntag/odml-ui
bd1ba1b5a04e4409d1f5b05fc491411963ded1fd
[ "BSD-3-Clause" ]
3
2017-03-06T17:00:45.000Z
2020-05-05T20:59:28.000Z
odmlui/helpers.py
mpsonntag/odml-ui
bd1ba1b5a04e4409d1f5b05fc491411963ded1fd
[ "BSD-3-Clause" ]
138
2017-02-27T17:08:32.000Z
2021-02-10T14:06:45.000Z
odmlui/helpers.py
mpsonntag/odml-ui
bd1ba1b5a04e4409d1f5b05fc491411963ded1fd
[ "BSD-3-Clause" ]
7
2017-03-07T06:39:18.000Z
2020-04-19T12:54:51.000Z
""" The 'helpers' module provides various helper functions. """ import getpass import json import os import subprocess import sys from odml import fileio from odml.dtypes import default_values from odml.tools.parser_utils import SUPPORTED_PARSERS from .treemodel import value_model try: # Python 3 from urllib.parse import urlparse, unquote, urljoin from urllib.request import pathname2url except ImportError: # Python 2 from urlparse import urlparse, urljoin from urllib import unquote, pathname2url def uri_to_path(uri): """ *uri_to_path* parses a uri into a OS specific file path. :param uri: string containing a uri. :return: OS specific file path. """ net_locator = urlparse(uri).netloc curr_path = unquote(urlparse(uri).path) file_path = os.path.join(net_locator, curr_path) # Windows specific file_path handling if os.name == "nt" and file_path.startswith("/"): file_path = file_path[1:] return file_path def path_to_uri(path): """ Converts a passed *path* to a URI GTK can handle and returns it. """ uri = pathname2url(path) uri = urljoin('file:', uri) return uri def get_extension(path): """ Returns the upper case file extension of a file referenced by a passed *path*. """ ext = os.path.splitext(path)[1][1:] ext = ext.upper() return ext def get_parser_for_uri(uri): """ Sanitize the given path, and also return the odML parser to be used for the given path. """ path = uri_to_path(uri) parser = get_extension(path) if parser not in SUPPORTED_PARSERS: parser = 'XML' return parser def get_parser_for_file_type(file_type): """ Checks whether a provided file_type is supported by the currently available odML parsers. Returns either the identified parser or XML as the fallback parser. """ parser = file_type.upper() if parser not in SUPPORTED_PARSERS: parser = 'XML' return parser def handle_section_import(section): """ Augment all properties of an imported section according to odml-ui needs. :param section: imported odml.BaseSection """ for prop in section.properties: handle_property_import(prop) # Make sure properties down the rabbit hole are also treated. for sec in section.sections: handle_section_import(sec) def handle_property_import(prop): """ Every odml-ui property requires at least one default value according to its dtype, otherwise the property is currently broken. Further the properties are augmented with 'pseudo_values' which need to be initialized and added to each property. :param prop: imported odml.BaseProperty """ if len(prop.values) < 1: if prop.dtype: prop.values = [default_values(prop.dtype)] else: prop.values = [default_values('string')] create_pseudo_values([prop]) def create_pseudo_values(odml_properties): """ Creates a treemodel.Value for each value in an odML Property and appends the resulting list as *pseudo_values* to the passed odML Property. """ for prop in odml_properties: values = prop.values new_values = [] for index in range(len(values)): val = value_model.Value(prop, index) new_values.append(val) prop.pseudo_values = new_values def get_conda_root(): """ Checks for an active Anaconda environment. :return: Either the root of an active Anaconda environment or an empty string. """ # Try identifying conda the easy way if "CONDA_PREFIX" in os.environ: return os.environ["CONDA_PREFIX"] # Try identifying conda the hard way try: conda_json = subprocess.check_output("conda info --json", shell=True, stderr=subprocess.PIPE) except subprocess.CalledProcessError as exc: print("[Info] Conda check: %s" % exc) return "" if sys.version_info.major > 2: conda_json = conda_json.decode("utf-8") dec = json.JSONDecoder() try: root_path = dec.decode(conda_json)['default_prefix'] except ValueError as exc: print("[Info] Conda check: %s" % exc) return "" if sys.version_info.major < 3: root_path = str(root_path) return root_path def run_odmltables(file_uri, save_dir, odml_doc, odmltables_wizard): """ Saves an odML document to a provided folder with the file ending '.odml' in format 'XML' to ensure an odmltables supported file. It then executes odmltables with the provided wizard and the created file. :param file_uri: File URI of the odML document that is handed over to odmltables. :param save_dir: Directory where the temporary file is saved to. :param odml_doc: An odML document. :param odmltables_wizard: supported values are 'compare', 'convert', 'filter' and 'merge'. """ tail = os.path.split(uri_to_path(file_uri))[1] tmp_file = os.path.join(save_dir, ("%s.odml" % tail)) fileio.save(odml_doc, tmp_file) try: subprocess.Popen(['odmltables', '-w', odmltables_wizard, '-f', tmp_file]) except Exception as exc: print("[Warning] Error running odml-tables: %s" % exc) def get_username(): """ :return: Full name or username of the current user """ username = getpass.getuser() try: # this only works on linux import pwd fullname = pwd.getpwnam(username).pw_gecos if fullname: username = fullname except ImportError: pass return username.rstrip(",")
27.338095
82
0.659815
fd9fb12d6a255983397f47fb91d956bce471d4bb
3,511
py
Python
mindspore/dataset/transforms/c_transforms.py
Xylonwang/mindspore
ea37dc76f0a8f0b10edd85c2ad545af44552af1e
[ "Apache-2.0" ]
1
2020-06-17T07:05:45.000Z
2020-06-17T07:05:45.000Z
mindspore/dataset/transforms/c_transforms.py
Xylonwang/mindspore
ea37dc76f0a8f0b10edd85c2ad545af44552af1e
[ "Apache-2.0" ]
null
null
null
mindspore/dataset/transforms/c_transforms.py
Xylonwang/mindspore
ea37dc76f0a8f0b10edd85c2ad545af44552af1e
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Huawei Technologies Co., Ltd # # 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. # ============================================================================== """ This module c_transforms provides common operations, including OneHotOp and TypeCast. """ import numpy as np import mindspore._c_dataengine as cde from .validators import check_num_classes, check_de_type, check_fill_value, check_slice_op from ..core.datatypes import mstype_to_detype
31.630631
111
0.621191
fda32d9ef88615859faf1c308e9468dde8a656a0
2,264
py
Python
cgatpipelines/tools/pipeline_docs/pipeline_rrbs/trackers/rrbsReport.py
kevinrue/cgat-flow
02b5a1867253c2f6fd6b4f3763e0299115378913
[ "MIT" ]
49
2015-04-13T16:49:25.000Z
2022-03-29T10:29:14.000Z
cgatpipelines/tools/pipeline_docs/pipeline_rrbs/trackers/rrbsReport.py
kevinrue/cgat-flow
02b5a1867253c2f6fd6b4f3763e0299115378913
[ "MIT" ]
252
2015-04-08T13:23:34.000Z
2019-03-18T21:51:29.000Z
cgatpipelines/tools/pipeline_docs/pipeline_rrbs/trackers/rrbsReport.py
kevinrue/cgat-flow
02b5a1867253c2f6fd6b4f3763e0299115378913
[ "MIT" ]
22
2015-05-21T00:37:52.000Z
2019-09-25T05:04:27.000Z
import re from CGATReport.Tracker import * from CGATReport.Utils import PARAMS as P # get from config file UCSC_DATABASE = "hg19" EXPORTDIR = "export" ################################################################### ################################################################### ################################################################### ################################################################### # Run configuration script EXPORTDIR = P.get('exome_exportdir', P.get('exportdir', 'export')) DATADIR = P.get('exome_datadir', P.get('datadir', '.')) DATABASE = P.get('exome_backend', P.get('sql_backend', 'sqlite:///./csvdb')) TRACKS = ['WTCHG_10997_01', 'WTCHG_10997_02'] ########################################################################### def linkToUCSC(contig, start, end): '''build URL for UCSC.''' ucsc_database = UCSC_DATABASE link = "`%(contig)s:%(start)i..%(end)i <http://genome.ucsc.edu/cgi-bin/hgTracks?db=%(ucsc_database)s&position=%(contig)s:%(start)i..%(end)i>`_" \ % locals() return link ###########################################################################
31.444444
149
0.518993
fda439b250b37d77743740f40f14e6a0ae152586
512
py
Python
leetcode/python/985_sum_of_even_number_after_queries.py
VVKot/leetcode-solutions
7d6e599b223d89a7861929190be715d3b3604fa4
[ "MIT" ]
4
2019-04-22T11:57:36.000Z
2019-10-29T09:12:56.000Z
leetcode/python/985_sum_of_even_number_after_queries.py
VVKot/coding-competitions
7d6e599b223d89a7861929190be715d3b3604fa4
[ "MIT" ]
null
null
null
leetcode/python/985_sum_of_even_number_after_queries.py
VVKot/coding-competitions
7d6e599b223d89a7861929190be715d3b3604fa4
[ "MIT" ]
null
null
null
from typing import List
26.947368
67
0.451172
fda4de20d32afa6769144964f3e6cd00599e20ed
7,400
py
Python
data.py
MicBrain/Laziness-Finder
42f0a8c21ca80f81c540914b7fbe7d0491b5452b
[ "MIT" ]
3
2015-01-06T19:58:47.000Z
2015-06-08T19:47:11.000Z
data.py
MicBrain/Laziness-Finder
42f0a8c21ca80f81c540914b7fbe7d0491b5452b
[ "MIT" ]
null
null
null
data.py
MicBrain/Laziness-Finder
42f0a8c21ca80f81c540914b7fbe7d0491b5452b
[ "MIT" ]
null
null
null
import csv # Finding States' Laziness Rankings: # dataDict = {} with open('data.csv', 'rU') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: state = row[0] row.pop(0) dataDict[state] = row projectedmeans = [] with open('rafadata.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: projectedmeans.append(row[0]) gdps = [] with open('gdp data.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: for letter in row[1]: if letter == ',': row[1].remove(letter) gdps.append((row[0], float(row[1]))) gdps.sort(key=lambda x: x[0]) obesitylevels = [] with open('Obesity data.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: for letter in row[1]: if letter == ',': row[1].remove(letter) obesitylevels.append((row[0], float(row[1]))) educationlevels = [] with open('education data.csv', 'rb') as csvfile: dataReader = csv.reader(csvfile, delimiter=',') for row in dataReader: for letter in row[1]: if letter == ',': row[1].remove(letter) educationlevels.append((row[0], float(row[1]))) educationlevels.sort(key=lambda x: x[0]) projectedmeans = map(float, projectedmeans) meanlist = [] for i in dataDict: i = [i] meanlist.append(i) index = 0 while index < 50: meanlist[index].append(projectedmeans[index]) index +=1 # Add relevant information # meanlist.sort(key=lambda x: x[0]) index = 0 while index<50: meanlist[index].append(gdps[index][1]) meanlist[index].append(obesitylevels[index][1]) meanlist[index].append(educationlevels[index][1]) index +=1 meanlist.sort(key=lambda x: x[1], reverse= True) # Adding rank to each state# index = 0 rank = 10 n = 0 go = True while go: for i in range(0,5): meanlist[index].insert(0, rank) index +=1 rank -=1 if rank ==0: go = False #Finding your laziness ranking: # answers = [] import os os.system('clear') print("Laziness Ranker Version 1.0") print print("Question 1") print print("Which of the following activities is your favorite?") print print("A. Going rock climbing.") print("B. Gardening") print("C. Hanging out with friends") print("D. Playing GTA V") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 2") print print("If you saw a baby drowning in a pool, what would you do FIRST?") print print("A. Jump in immediately to save it.") print("B. Make sure no one else is already diving in before saving it.") print("C. Call 911") print("D. Slowly put down your sweaty cheesburger and wipe the ketchup from your fingers before applying sun lotion to make sure you don't get burnt whilst saving the poor kid") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 3") print print("What is the reminder of 47/2?") print print("A. 1") print("B. 47") print("C. Can I phone a friend?") print("D. I'm skipping this question.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 4") print print("What's your favorite movie?") print print("A. Donnie Darko") print("B. Inception") print("C. The Avengers") print("D. Anything with Adam Sandler.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 5") print print("Approximately how much of your leisure time is spent doing physical activity?") print print("A. 80%") print("B. 50%") print("C. 30%") print("D. 10%") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 6") print print("What would you do if someone ran by and snatched your purse/wallet?") print print("A. Trip the basterd.") print("B. Run after the stealer.") print("C. Call 911") print("D. 'Eh. Wasn't that great of a wallet anyway.'") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 7") print print("What is your favorite nightly activity?") print print("A. Krav Maga.") print("B. Taking the dog for a walk") print("C. Watching TV") print("D. Watching cat videos on Youtube") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 8") print print("Which item is closest to you at your desk in your room?") print print("A. Treadmill") print("B. Stress ball") print("C. Potato chips") print("D. Everything is way too far away for my arm to reach.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 9") print print("What's your favorite animal?") print print("A. Freakin' Tigers") print("B. Hawks") print("C. Turtles") print("D. Sloths") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) os.system('clear') print print("Question 10") print print("Why are we here?") print print("A. To understand our world, and help each other out at the same time") print("B. To eat and mate.") print("C. It's way too early in the morning for this type of question.") print("D. It's way too late in the evening for this type of question.") print answer = raw_input("Please enter the letter of your answer here: ").lower() answers.append(answer) rank = rank(score(answers)) # Matching you with a group of states # yourstates1 = filter(correctstate, meanlist) yourstates = [] index = 0 while index<len(yourstates1): yourstates.append(yourstates1[index]) index +=1 os.system('clear') print("Based on your level of physical activity, we suggest you move to one of these states:") print returnstates(yourstates, 0) returnstates(yourstates, 1) returnstates(yourstates, 2) returnstates(yourstates, 3) returnstates(yourstates, 4)
24.749164
177
0.672973
fda704c8c3598728280ac25d245978289f33459f
1,540
py
Python
camera/start.py
IbrahimAhmad65/pythonApp
76c6e2a6de48d34b034bfc0e045cc345b90bf45c
[ "MIT" ]
null
null
null
camera/start.py
IbrahimAhmad65/pythonApp
76c6e2a6de48d34b034bfc0e045cc345b90bf45c
[ "MIT" ]
null
null
null
camera/start.py
IbrahimAhmad65/pythonApp
76c6e2a6de48d34b034bfc0e045cc345b90bf45c
[ "MIT" ]
null
null
null
#/bin/python3 import numpy as np from PIL import Image img = Image.open('checker.png') #array = 255 - array #invimg = Image.fromarray(array) #invimg.save('testgrey-inverted.png') img = Image.fromarray(process(img,0,0,0)) img.save("newchecker.png")
26.101695
193
0.555844
fda7b7ab5e740804c9088eb3b79d539461e5afae
1,290
py
Python
esque/cli/commands/edit/topic.py
real-digital/esque
0b779fc308ce8bce45c1903f36c33664b2e832e7
[ "MIT" ]
29
2019-05-10T21:12:38.000Z
2021-08-24T08:09:49.000Z
esque/cli/commands/edit/topic.py
real-digital/esque
0b779fc308ce8bce45c1903f36c33664b2e832e7
[ "MIT" ]
103
2019-05-17T07:21:41.000Z
2021-12-02T08:29:00.000Z
esque/cli/commands/edit/topic.py
real-digital/esque
0b779fc308ce8bce45c1903f36c33664b2e832e7
[ "MIT" ]
2
2019-05-28T06:45:14.000Z
2019-11-21T00:33:15.000Z
import click from esque import validation from esque.cli.autocomplete import list_topics from esque.cli.helpers import edit_yaml, ensure_approval from esque.cli.options import State, default_options from esque.cli.output import pretty_topic_diffs from esque.resources.topic import copy_to_local
34.864865
115
0.762016
fda80efdae2846a2b9845cad8f9cce0c191ea1d2
134
py
Python
euporie/__main__.py
joouha/euporie
7f1cf9a3b4061b662c1e56b16a3a8883bd50e315
[ "MIT" ]
505
2021-05-08T22:52:19.000Z
2022-03-31T15:52:43.000Z
euporie/__main__.py
joouha/euporie
7f1cf9a3b4061b662c1e56b16a3a8883bd50e315
[ "MIT" ]
19
2021-05-09T09:06:40.000Z
2022-03-26T14:49:35.000Z
euporie/__main__.py
joouha/euporie
7f1cf9a3b4061b662c1e56b16a3a8883bd50e315
[ "MIT" ]
16
2021-05-09T00:07:14.000Z
2022-03-28T09:16:11.000Z
# -*- coding: utf-8 -*- """Main entry point into euporie.""" from euporie.app import App if __name__ == "__main__": App.launch()
19.142857
36
0.634328
fda8d40081b9fb4ec44129fb7abfaa7410ce0508
9,535
py
Python
robocorp-python-ls-core/src/robocorp_ls_core/pluginmanager.py
anton264/robotframework-lsp
6f8f89b88ec56b767f6d5e9cf0d3fb58847e5844
[ "ECL-2.0", "Apache-2.0" ]
92
2020-01-22T22:15:29.000Z
2022-03-31T05:19:16.000Z
robocorp-python-ls-core/src/robocorp_ls_core/pluginmanager.py
anton264/robotframework-lsp
6f8f89b88ec56b767f6d5e9cf0d3fb58847e5844
[ "ECL-2.0", "Apache-2.0" ]
604
2020-01-25T17:13:27.000Z
2022-03-31T18:58:24.000Z
robocorp-python-ls-core/src/robocorp_ls_core/pluginmanager.py
anton264/robotframework-lsp
6f8f89b88ec56b767f6d5e9cf0d3fb58847e5844
[ "ECL-2.0", "Apache-2.0" ]
39
2020-02-06T00:38:06.000Z
2022-03-15T06:14:19.000Z
# Original work Copyright 2018 Brainwy Software Ltda (Dual Licensed: LGPL / Apache 2.0) # From https://github.com/fabioz/pyvmmonitor-core # See ThirdPartyNotices.txt in the project root for license information. # All modifications Copyright (c) Robocorp Technologies Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable 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. """ Defines a PluginManager (which doesn't really have plugins, only a registry of extension points and implementations for such extension points). To use, create the extension points you want (any class starting with 'EP') and register implementations for those. I.e.: pm = PluginManager() pm.register(EPFoo, FooImpl, keep_instance=True) pm.register(EPBar, BarImpl, keep_instance=False) Then, later, to use it, it's possible to ask for instances through the PluginManager API: foo_instances = pm.get_implementations(EPFoo) # Each time this is called, new # foo_instances will be created bar_instance = pm.get_instance(EPBar) # Each time this is called, the same bar_instance is returned. Alternatively, it's possible to use a decorator to use a dependency injection pattern -- i.e.: don't call me, I'll call you ;) @inject(foo_instance=EPFoo, bar_instances=[EPBar]) def m1(foo_instance, bar_instances, pm): for bar in bar_instances: ... foo_instance.foo """ import functools from pathlib import Path from typing import TypeVar, Any, Dict, Type, Tuple, Optional, Union T = TypeVar("T")
35.446097
100
0.607971
fdaa4e938b8821b9a6f605b0dbe6cbeea3d62940
25
py
Python
version.py
vignesh1793/gmail_reader
8bcf8dbc4e839e8eb736c1ae2fef9fd4f9f77ded
[ "MIT" ]
1
2020-07-29T03:35:26.000Z
2020-07-29T03:35:26.000Z
version.py
thevickypedia/gmail_reader
8bcf8dbc4e839e8eb736c1ae2fef9fd4f9f77ded
[ "MIT" ]
null
null
null
version.py
thevickypedia/gmail_reader
8bcf8dbc4e839e8eb736c1ae2fef9fd4f9f77ded
[ "MIT" ]
null
null
null
version_info = (0, 5, 2)
12.5
24
0.6
fdab78fe2c0240156557e76473319683d8e4d96e
291
py
Python
hippynn/interfaces/__init__.py
tautomer/hippynn
df4504a5ea4680cfc61f490984dcddeac7ed99ee
[ "BSD-3-Clause" ]
21
2021-11-17T00:56:35.000Z
2022-03-22T05:57:11.000Z
hippynn/interfaces/__init__.py
tautomer/hippynn
df4504a5ea4680cfc61f490984dcddeac7ed99ee
[ "BSD-3-Clause" ]
4
2021-12-17T16:16:53.000Z
2022-03-16T23:50:38.000Z
hippynn/interfaces/__init__.py
tautomer/hippynn
df4504a5ea4680cfc61f490984dcddeac7ed99ee
[ "BSD-3-Clause" ]
6
2021-11-30T21:09:31.000Z
2022-03-18T07:07:32.000Z
""" ``hippynn`` currently has interfaces to the following other codes: 1. ``ase`` for atomic simulation 2. ``pyseqm`` for combined ML-seqm models 3. ``schnetpack`` for usage of schnet models in ``hippynn``. This subpackage is not available by default; you must import it explicitly. """
24.25
75
0.721649
fdac411261e3837a075f2bf9d23c9a72e80c187a
459
py
Python
code/data_owner_1/get_connection.py
ClarkYan/msc-thesis
c4fbd901c2664aa7140e5e82fb322ed0f578761a
[ "Apache-2.0" ]
7
2017-11-05T08:22:51.000Z
2021-09-14T19:34:30.000Z
code/data_owner_1/get_connection.py
ClarkYan/msc-thesis
c4fbd901c2664aa7140e5e82fb322ed0f578761a
[ "Apache-2.0" ]
1
2021-02-27T07:24:50.000Z
2021-04-24T03:29:12.000Z
code/data_owner_1/get_connection.py
ClarkYan/msc-thesis
c4fbd901c2664aa7140e5e82fb322ed0f578761a
[ "Apache-2.0" ]
3
2019-04-15T03:22:22.000Z
2022-03-12T11:27:39.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Author: ClarkYAN -*- import requests
27
75
0.625272
fdad3ab7cf57f8eea008adff9a2f0ea59bd908a4
1,553
py
Python
signup_instagram.py
cnfreitax/all_scrapers
35597cd3845c64b589cb2937ea7ea70ea4cd3286
[ "Apache-2.0" ]
null
null
null
signup_instagram.py
cnfreitax/all_scrapers
35597cd3845c64b589cb2937ea7ea70ea4cd3286
[ "Apache-2.0" ]
null
null
null
signup_instagram.py
cnfreitax/all_scrapers
35597cd3845c64b589cb2937ea7ea70ea4cd3286
[ "Apache-2.0" ]
null
null
null
""" use of script to create the login method use a fake account! """ from selenium import webdriver from time import sleep from bs4 import BeautifulSoup as bs
35.295455
151
0.647778
fdad5082e78e4cecb0dc06f0019827b83dac2415
4,699
py
Python
ntee/utils/model_reader.py
AdityaAS/PyTorch_NTEE
a1dc5cc6cd22fc9de3f054fa35f50b975bae75ce
[ "MIT" ]
1
2019-01-15T11:21:08.000Z
2019-01-15T11:21:08.000Z
ntee/utils/model_reader.py
AdityaAS/PyTorch_NTEE
a1dc5cc6cd22fc9de3f054fa35f50b975bae75ce
[ "MIT" ]
null
null
null
ntee/utils/model_reader.py
AdityaAS/PyTorch_NTEE
a1dc5cc6cd22fc9de3f054fa35f50b975bae75ce
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import joblib import torch import numpy as np from ntee.utils.my_tokenizer import RegexpTokenizer from ntee.utils.vocab_joint import JointVocab from ntee.utils.vocab import Vocab class PyTorchModelReader(object): def get_word_vector(self, word, default=None): index = self._vocab.get_word_index(word) if index: return self.word_embedding[index] else: return default def get_entity_vector(self, title, default=None): index = self._vocab.get_entity_index(title) if index: return self.entity_embedding[index] else: return default def get_text_vector(self, text): vectors = [self.get_word_vector(t.text.lower()) for t in self._tokenizer.tokenize(text)] vectors = [v for v in vectors if v is not None] # vectors_numpy = [v.cpu().numpy() for v in vectors if v is not None] # ret_numpy = np.mean(vectors_numpy, axis=0) # ret_numpy = np.dot(ret_numpy, self._W.cpu().numpy()) # ret_numpy += self._b.cpu().numpy() # ret_numpy /= np.linalg.norm(ret_numpy, 2) # return ret_numpy if not vectors: return None ret = torch.zeros(vectors[0].shape) for v in vectors: ret += v ret = ret / len(vectors) ret = torch.matmul(ret, self._W) ret += self._b ret /= torch.norm(ret, 2) return ret
27.970238
83
0.589062
fdae4d589a0bfe5706d084ebb885895cfa2070d3
1,479
py
Python
setup.py
polishmatt/sputr
7611d40090c8115dff69912725efc506414ac47a
[ "MIT" ]
1
2017-02-13T23:09:18.000Z
2017-02-13T23:09:18.000Z
setup.py
polishmatt/sputr
7611d40090c8115dff69912725efc506414ac47a
[ "MIT" ]
6
2017-02-18T20:14:32.000Z
2017-09-27T19:07:06.000Z
setup.py
polishmatt/sputr
7611d40090c8115dff69912725efc506414ac47a
[ "MIT" ]
null
null
null
from setuptools import setup import importlib version = importlib.import_module('sputr.config').version setup( name='sputr', version=version, description='Simple Python Unit Test Runner', long_description="An intuitive command line and Python package interface for Python's unit testing framework.", author='Matt Wisniewski', author_email='sputr@mattw.us', license='MIT', url='https://github.com/polishmatt/sputr', keywords=['testing'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Testing', 'Topic :: Utilities', ], platforms=['unix','linux'], packages=[ 'sputr' ], install_requires=[ 'click==6.7' ], entry_points={ 'console_scripts': [ 'sputr = sputr.cli:cli' ], }, )
31.468085
115
0.597025
fdb047a38cb8eadeccbc08314dec72d4acb12c4f
1,820
py
Python
tools/malloc-exp/plot-histogram.py
scottviteri/verified-betrfs
7af56c8acd943880cb19ba16d146c6a206101d9b
[ "BSD-2-Clause" ]
15
2021-05-11T09:19:12.000Z
2022-03-14T10:39:05.000Z
tools/malloc-exp/plot-histogram.py
scottviteri/verified-betrfs
7af56c8acd943880cb19ba16d146c6a206101d9b
[ "BSD-2-Clause" ]
3
2021-06-07T21:45:13.000Z
2021-11-29T23:19:59.000Z
tools/malloc-exp/plot-histogram.py
scottviteri/verified-betrfs
7af56c8acd943880cb19ba16d146c6a206101d9b
[ "BSD-2-Clause" ]
7
2021-05-11T17:08:04.000Z
2022-02-23T07:19:36.000Z
#!/usr/bin/env python3 # Copyright 2018-2021 VMware, Inc., Microsoft Inc., Carnegie Mellon University, ETH Zurich, and University of Washington # SPDX-License-Identifier: BSD-2-Clause import matplotlib import matplotlib.pyplot as plt import numpy as np import re #import json parse()
24.594595
120
0.581868
fdb1f945768c5695ac9336664448e0864ebfec52
4,587
py
Python
oy/models/mixins/polymorphic_prop.py
mush42/oy-cms
66f2490be7eab9a692a68bb635099ba21d5944ae
[ "MIT" ]
5
2019-02-12T08:54:46.000Z
2021-03-15T09:22:44.000Z
oy/models/mixins/polymorphic_prop.py
mush42/oy-cms
66f2490be7eab9a692a68bb635099ba21d5944ae
[ "MIT" ]
2
2020-04-30T01:27:08.000Z
2020-07-16T18:04:16.000Z
oy/models/mixins/polymorphic_prop.py
mush42/oy-cms
66f2490be7eab9a692a68bb635099ba21d5944ae
[ "MIT" ]
3
2019-10-16T05:53:31.000Z
2021-10-11T09:37:16.000Z
# -*- coding: utf-8 -*- """ oy.models.mixins.polymorphic_prop ~~~~~~~~~~ Provides helper mixin classes for special sqlalchemy models :copyright: (c) 2018 by Musharraf Omer. :license: MIT, see LICENSE for more details. """ import sqlalchemy.types as types from sqlalchemy import literal_column, event from sqlalchemy.orm.interfaces import PropComparator from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.declarative import declared_attr from oy.boot.sqla import db
29.785714
84
0.625681
fdb2d4c9f5001e0fbebe90b3cb11e75763d20dd3
1,735
py
Python
tests/extensions/aria_extension_tosca/conftest.py
tnadeau/incubator-ariatosca
de32028783969bc980144afa3c91061c7236459c
[ "Apache-2.0" ]
null
null
null
tests/extensions/aria_extension_tosca/conftest.py
tnadeau/incubator-ariatosca
de32028783969bc980144afa3c91061c7236459c
[ "Apache-2.0" ]
null
null
null
tests/extensions/aria_extension_tosca/conftest.py
tnadeau/incubator-ariatosca
de32028783969bc980144afa3c91061c7236459c
[ "Apache-2.0" ]
1
2020-06-16T15:13:06.000Z
2020-06-16T15:13:06.000Z
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not 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. """ PyTest configuration module. Add support for a "--tosca-parser" CLI option. For more information on PyTest hooks, see the `PyTest documentation <https://docs.pytest.org/en/latest/writing_plugins.html#pytest-hook-reference>`__. """ import pytest from ...mechanisms.parsing.aria import AriaParser
35.408163
91
0.736023
fdb6180fad4a97a9bd7fd4c10c96bb8a853e03d5
5,487
py
Python
tests/test_project.py
eruber/py_project_template
f0b12ab603e1277943f0323cbd0d8fb86fd04861
[ "MIT" ]
null
null
null
tests/test_project.py
eruber/py_project_template
f0b12ab603e1277943f0323cbd0d8fb86fd04861
[ "MIT" ]
null
null
null
tests/test_project.py
eruber/py_project_template
f0b12ab603e1277943f0323cbd0d8fb86fd04861
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test Project Template The code below is derived from several locations: REFERENCES: REF1: https://docs.pytest.org/en/latest/contents.html REF2: https://github.com/hackebrot/pytest-cookies LOCATIONS LOC1: https://github.com/audreyr/cookiecutter-pypackage LOC2: https://github.com/mdklatt/cookiecutter-python-app LOC3: https://github.com/Springerle/py-generic-project """ # ---------------------------------------------------------------------------- # Python Standard Library Imports (one per line) # ---------------------------------------------------------------------------- import sys import shlex import os import sys import subprocess # import yaml import datetime from contextlib import contextmanager if sys.version_info > (3, 2): import io import os else: raise "Use Python 3.3 or higher" # ---------------------------------------------------------------------------- # External Third Party Python Module Imports (one per line) # ---------------------------------------------------------------------------- from cookiecutter.utils import rmtree # from click.testing import CliRunner # ---------------------------------------------------------------------------- # Project Specific Module Imports (one per line) # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- __author__ = 'E.R. Uber (eruber@gmail.com)' __license__ = 'MIT' __copyright__ = "Copyright (C) 2017 by E.R. Uber" # ---------------------------------------------------------------------------- # Module Global & Constant Definitions # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- # Test Support... # ---------------------------------------------------------------------------- # [LOC1] # [LOC1] # [LOC1] def run_inside_dir(command, dirpath): """ Run a command from inside a given directory, returning the exit status :param command: Command that will be executed :param dirpath: String, path of the directory the command is being run. """ with inside_dir(dirpath): return subprocess.check_call(shlex.split(command)) # [LOC1] def check_output_inside_dir(command, dirpath): "Run a command from inside a given directory, returning the command output" with inside_dir(dirpath): return subprocess.check_output(shlex.split(command)) # [LOC1] def project_info(result): """Get toplevel dir, project_slug, and project dir from baked cookies""" project_path = str(result.project) project_slug = os.path.split(project_path)[-1] project_dir = os.path.join(project_path, project_slug) return project_path, project_slug, project_dir # ---------------------------------------------------------------------------- # Tests... # ---------------------------------------------------------------------------- # [LOC1] # [LOC1] # ["MIT", "BSD3", "ISC", "Apache2", "GNU-GPL-v3", "Not open source"] # ---------------------------------------------------------------------------- if __name__ == "__main__": pass
32.467456
101
0.546382
fdbbcdb74fb497d41cae48ac2a6300801085c4fc
2,053
py
Python
tag.py
tom-choi/NLPforPIXIV
77e905793c792ec97f196a4da7144456018577c7
[ "MIT" ]
1
2022-03-18T09:10:59.000Z
2022-03-18T09:10:59.000Z
tag.py
tom-choi/NLPforPIXIV
77e905793c792ec97f196a4da7144456018577c7
[ "MIT" ]
null
null
null
tag.py
tom-choi/NLPforPIXIV
77e905793c792ec97f196a4da7144456018577c7
[ "MIT" ]
null
null
null
import json from msilib.schema import Directory import pandas as pd import csv with open('./result-#succubus Drawings, Best Fan Art on pixiv, Japan-1647491083659.json', 'r',encoding="utf-8") as f: data = json.load(f) Tags_Directory = {} print(f"{len(data)}tag") n = len(data) for i in range(0,n): #print(f"idNum:{data[i]['idNum']} tag:{len(data[i]['tagsWithTransl'])}") for j in range(0,len(data[i]['tagsWithTransl'])): if (data[i]['tagsWithTransl'][j] in Tags_Directory): Tags_Directory[data[i]['tagsWithTransl'][j]] += 1 else: Tags_Directory[data[i]['tagsWithTransl'][j]] = 1 # print(f"Tags_Directory tags: ") # for key in Tags_Directory.keys(): # print(f"{key} : {Tags_Directory[key]}") pd_Tags_Directory = [] pd_Tags_Directory_ID = {} i = 0 print("") for key in Tags_Directory.keys(): pd_Tags_Directory.append(key) pd_Tags_Directory_ID[key] = i i += 1 with open('./pd_Tags_Directory_ID.json', 'w+',encoding="utf-8") as f: json.dump(pd_Tags_Directory_ID,f) print(f"( {len(Tags_Directory)} tags)") # for i in range(0,n): # for j in range(0,len(data[i]['tagsWithTransl'])): # if (data[i]['tagsWithTransl'][j] in Tags_Directory): # Tags_Directory[data[i]['tagsWithTransl'][j]] += 1 # else: # Tags_Directory[data[i]['tagsWithTransl'][j]] = 1 # k = 0 # times = 1 # print(f":Tags ({k}/{n})") # Count_Tags = {"kEySSS": pd_Tags_Directory} # for key in pd_Tags_Directory_ID: # Count_Tag = [0 for _ in range(len(pd_Tags_Directory_ID))] # for i in range(0,n): # if (key not in data[i]['tagsWithTransl']): # continue # else: # for j in range(0,len(data[i]['tagsWithTransl'])): # Count_Tag[pd_Tags_Directory_ID[data[i]['tagsWithTransl'][j]]] += 1 # Count_Tags[key] = Count_Tag # k += 1 # if (k % (n//100) == 0): # print(f":Tags ({k}/{n}) {times}%") # times += 1 # print(f"!excel") # #print(pd_Tags_Directory) # df = pd.DataFrame(Count_Tags) # df.to_csv('trainning.csv') # print(df)
33.112903
117
0.649781
fdbd3757fbcb05b2b219ad506437967a7305ef32
3,583
py
Python
event_handlers/voyager_event_handler.py
bigpizza/VoyagerTelegramBot
8b1e3cbebe9041b0ca341ce4d5d9835f5e12b4d9
[ "MIT" ]
null
null
null
event_handlers/voyager_event_handler.py
bigpizza/VoyagerTelegramBot
8b1e3cbebe9041b0ca341ce4d5d9835f5e12b4d9
[ "MIT" ]
null
null
null
event_handlers/voyager_event_handler.py
bigpizza/VoyagerTelegramBot
8b1e3cbebe9041b0ca341ce4d5d9835f5e12b4d9
[ "MIT" ]
null
null
null
from abc import abstractmethod from typing import Dict, Tuple from curse_manager import CursesManager from telegram import TelegramBot
36.191919
116
0.597823
fdbd68dd1e0a0ba0978c1bd0880d05f492ec5829
3,063
py
Python
fluentcms_bootstrap_grid/content_plugins.py
edoburu/fluentcms-bootstrap-grid
67a8255e34e22284eeb05c04517671311305d370
[ "Apache-2.0" ]
null
null
null
fluentcms_bootstrap_grid/content_plugins.py
edoburu/fluentcms-bootstrap-grid
67a8255e34e22284eeb05c04517671311305d370
[ "Apache-2.0" ]
null
null
null
fluentcms_bootstrap_grid/content_plugins.py
edoburu/fluentcms-bootstrap-grid
67a8255e34e22284eeb05c04517671311305d370
[ "Apache-2.0" ]
null
null
null
from django import forms from django.utils.encoding import force_text from django.utils.translation import pgettext, ugettext_lazy as _ from fluent_contents.extensions import ContainerPlugin, plugin_pool, ContentItemForm from . import appsettings from .models import BootstrapRow, BootstrapColumn GRID_COLUMNS = appsettings.FLUENTCMS_BOOTSTRAP_GRID_COLUMNS SIZE_CHOICES = _get_size_choices() OFFSET_CHOICES = [('', '----')] + [(i, force_text(i)) for i in range(1, GRID_COLUMNS + 1)] size_widget = forms.Select(choices=SIZE_CHOICES) offset_widget = forms.Select(choices=OFFSET_CHOICES) push_widget = forms.Select(choices=OFFSET_CHOICES)
32.935484
90
0.642507
fdbd9c9ab6b561ed49a22efac24abb031c9653d8
8,083
py
Python
study.py
Yougeeg/zhihuiguo
21cfa4210b011e0fbc200774b88e570d21e30ab2
[ "MIT" ]
null
null
null
study.py
Yougeeg/zhihuiguo
21cfa4210b011e0fbc200774b88e570d21e30ab2
[ "MIT" ]
null
null
null
study.py
Yougeeg/zhihuiguo
21cfa4210b011e0fbc200774b88e570d21e30ab2
[ "MIT" ]
2
2017-11-04T08:46:04.000Z
2018-09-12T08:16:44.000Z
import logging import json from datetime import datetime, timedelta from getpass import getpass import uuid import requests from Cryptodome.PublicKey import RSA import utils NONE, SIGN, TICKET = 0, 1, 2 SERVER = 'https://appstudentapi.zhihuishu.com' SSL_VERIFY = True TAKE_EXAMS = True SKIP_FINAL_EXAM = False EXAM_AUTO_SUBMIT = True if __name__ == '__main__': logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', level=logging.INFO) logger = logging.getLogger() logger.info('I love studying! Study makes me happy!') rsa_key = RSA.import_key(open('key.pem', 'r').read()) app_key = utils.md5_digest(str(uuid.uuid4()).replace('-', '')) s = requests.Session() s.headers.update({ 'User-Agent': 'Dalvik/2.1.0 (Linux; U; Android 7.1.1; Nexus 5X Build/NOF27B', 'Accept-Encoding': 'gzip', 'App-Key': app_key}) secret = '' ticket = '' try: import userinfo user = userinfo.USER name = userinfo.NAME secret = userinfo.SECRET if input(f'Current user:{user} {name}:[y/n]') != 'y': user, name, secret = login() except: user, name, secret = login() SERVER += '/appstudent' p = {'userId': user} d = post(SIGN, '/student/tutorial/getStudyingCourses', p) course_id, recruit_id, link_course_id = 0, 0, 0 if d is None: logger.info('No studying courses.') exit() for course in d: if input(course['courseName'] + ':[y/n]') == 'y': course_id = course['courseId'] recruit_id = course['recruitId'] link_course_id = course['linkCourseId'] break if course_id == 0: exit() p = {'recruitId': recruit_id, 'courseId': course_id, 'userId': user} chapter_list = post(SIGN, '/appserver/student/getCourseInfo', p)['chapterList'] for chapter in chapter_list: for lesson in chapter['lessonList']: if lesson['sectionList'] is not None: for section in lesson['sectionList']: save_record(section, lesson['chapterId'], lesson['id']) else: save_record(lesson, None, None) logger.info('Videos done.') if TAKE_EXAMS is False: exit() p = {'mobileType': 2, 'recruitId': recruit_id, 'courseId': course_id, 'page': 1, 'userId': user, 'examType': 1, 'schoolId': -1, 'pageSize': 20} # examType=2 is for finished exams exam_list = post(SIGN, '/appserver/exam/findAllExamInfo', p)['stuExamDtoList'] for exam in exam_list: logger.info(exam['examInfoDto']['name']) exam_type = exam['examInfoDto']['type'] if exam_type == 2: # Final exams if SKIP_FINAL_EXAM is True: logger.info('Skipped final exam.') continue exam_id = exam['examInfoDto']['examId'] student_exam_id = exam['studentExamInfoDto']['id'] question_ids = [] p = {'userId': user} rt = post(SIGN, '/student/exam/canIntoExam', p) if rt != 1: logger.info('Cannot into exam.') continue p = {'recruitId': recruit_id, 'examId': exam_id, 'isSubmit': 0, 'studentExamId': student_exam_id, 'type': exam_type, 'userId': user} ids = post(SIGN, '/student/exam/examQuestionIdListByCache', p)['examList'] p.pop('isSubmit') p.pop('type') for exam_question in ids: question_ids.append(str(exam_question['questionId'])) p['questionIds'] = question_ids questions = post(SIGN, '/student/exam/questionInfos', p) for question_id in question_ids: question = questions[question_id] logger.info(question['firstname']) if question['questionTypeName'] == '' or '': answer = question['realAnswer'].split(',') else: EXAM_AUTO_SUBMIT = False continue pa = [{'deviceType': '1', 'examId': str(exam_id), 'userId': str(user), 'stuExamId': str(student_exam_id), 'questionId': str(question_id), 'recruitId': str(recruit_id), 'answerIds': answer, 'dataIds': []}] json_str = json.dumps(pa, separators=(',', ':')) pb = {'mobileType': 2, 'jsonStr': json_str, 'secretStr': utils.rsa_encrypt(rsa_key, json_str), 'versionKey': 1} rt = post(SIGN, '/student/exam/saveExamAnswer', pb) logger.info(rt[0]['messages']) if not EXAM_AUTO_SUBMIT: continue pa = {'deviceType': '1', 'userId': str(user), 'stuExamId': str(student_exam_id), 'recruitId': recruit_id, 'examId': str(exam_id), 'questionIds': question_ids, 'remainingTime': '0', 'achieveCount': str(question_ids.__len__())} json_str = json.dumps(pa, separators=(',', ':')) pb = {'mobileType': 2, 'recruitId': recruit_id, 'examId': str(exam_id), 'userId': user, 'jsonStr': json_str, 'secretStr': utils.rsa_encrypt(rsa_key, json_str), 'type': exam_type, 'versionKey': 1} raw = post(SIGN, '/student/exam/submitExamInfo', pb, raw=True) rt = json.loads(raw.replace('"{', '{').replace('}"', '}').replace('\\', ''))['rt'] logger.info(f'{rt["messages"]} Score: {rt["errorInfo"]["score"]}') logger.info('Exams done.')
39.237864
117
0.588767
fdbe327728712dcbbd59d238061b617718c7c9a0
244
py
Python
autogl/module/feature/_base_feature_engineer/__init__.py
dedsec-9/AutoGL
487f2b2f798b9b1363ad5dc100fb410b12222e06
[ "MIT" ]
null
null
null
autogl/module/feature/_base_feature_engineer/__init__.py
dedsec-9/AutoGL
487f2b2f798b9b1363ad5dc100fb410b12222e06
[ "MIT" ]
null
null
null
autogl/module/feature/_base_feature_engineer/__init__.py
dedsec-9/AutoGL
487f2b2f798b9b1363ad5dc100fb410b12222e06
[ "MIT" ]
null
null
null
import autogl if autogl.backend.DependentBackend.is_dgl(): from ._base_feature_engineer_dgl import BaseFeatureEngineer else: from ._base_feature_engineer_pyg import BaseFeatureEngineer
22.181818
63
0.811475
fdc0b230d2a0f01f084eb9ceb1e8ca8a841fb58f
1,440
py
Python
python/controllers/ner_annotation_api.py
barkavi87/anuvaad-corpus
9ea832f4228f61a7d4998205976629ea4b7c3d70
[ "MIT" ]
2
2019-12-20T08:58:10.000Z
2020-05-15T14:17:43.000Z
python/controllers/ner_annotation_api.py
barkavi87/anuvaad-corpus
9ea832f4228f61a7d4998205976629ea4b7c3d70
[ "MIT" ]
73
2019-08-12T16:17:33.000Z
2022-01-13T01:24:38.000Z
python/controllers/ner_annotation_api.py
barkavi87/anuvaad-corpus
9ea832f4228f61a7d4998205976629ea4b7c3d70
[ "MIT" ]
1
2020-08-24T09:51:46.000Z
2020-08-24T09:51:46.000Z
import os import urllib.request from flask import Flask, request, redirect, render_template, jsonify from flask import Blueprint, request, current_app as app from controllers.sc_judgment_header_ner_eval import SC_ner_annotation import json from models.response import CustomResponse from models.status import Status ner_annotation_api = Blueprint('ner_annotation_api', __name__)
43.636364
107
0.702083
fdc1c97e35e98b3788187bd4a1997c5b2842cc3b
4,594
py
Python
HandGenerator/HandGenerator.py
VASST/SlicerLeapMotion
d20215fb657eb5c972d1fe380bdf2d0479796c93
[ "MIT" ]
null
null
null
HandGenerator/HandGenerator.py
VASST/SlicerLeapMotion
d20215fb657eb5c972d1fe380bdf2d0479796c93
[ "MIT" ]
2
2019-09-06T16:06:20.000Z
2020-02-16T17:15:28.000Z
HandGenerator/HandGenerator.py
VASST/SlicerLeapMotion
d20215fb657eb5c972d1fe380bdf2d0479796c93
[ "MIT" ]
1
2020-01-14T17:49:31.000Z
2020-01-14T17:49:31.000Z
import sys import os import unittest import vtk, qt, ctk, slicer from slicer.ScriptedLoadableModule import * import logging import numpy as np # # HandGenerator # # # HandGeneratorWidget #
38.932203
233
0.680888
fdc27871983c6fc23e23bf1a61087b70dff46dd6
238
py
Python
test_api/movies/urls.py
xm4dn355x/drf_test
efdc38afa51d259fcb5781c9f8cc52f93e2fd81b
[ "MIT" ]
null
null
null
test_api/movies/urls.py
xm4dn355x/drf_test
efdc38afa51d259fcb5781c9f8cc52f93e2fd81b
[ "MIT" ]
null
null
null
test_api/movies/urls.py
xm4dn355x/drf_test
efdc38afa51d259fcb5781c9f8cc52f93e2fd81b
[ "MIT" ]
null
null
null
from django.urls import path from . import views urlpatterns = [ path('movie/', views.MovieListView.as_view()), path('movie/<int:pk>/', views.MovieDetailView.as_view()), path('review/', views.ReviewCreateView.as_view()), ]
21.636364
61
0.684874
fdc29b2d1755fa39792e6b6765f17fb3cfeeb9de
1,166
py
Python
commlib/utils.py
robotics-4-all/commlib-py
9d56e0a2e13410feac0e10d9866a1c4a60ade2c7
[ "MIT" ]
1
2021-06-09T09:32:53.000Z
2021-06-09T09:32:53.000Z
commlib/utils.py
robotics-4-all/commlib-py
9d56e0a2e13410feac0e10d9866a1c4a60ade2c7
[ "MIT" ]
7
2022-03-10T23:57:25.000Z
2022-03-13T19:12:54.000Z
commlib/utils.py
robotics-4-all/commlib-py
9d56e0a2e13410feac0e10d9866a1c4a60ade2c7
[ "MIT" ]
1
2021-06-07T16:25:05.000Z
2021-06-07T16:25:05.000Z
import re import uuid import time from typing import (Any, Callable, Dict, List, Optional, Tuple, Type, TypeVar, Union, Text) def camelcase_to_snakecase(_str: str) -> str: """camelcase_to_snakecase. Transform a camelcase string to snakecase Args: _str (str): String to apply transformation. Returns: str: Transformed string """ s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', _str) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() def gen_timestamp() -> int: """gen_timestamp. Generate a timestamp. Args: Returns: int: Timestamp in integer representation. User `str()` to transform to string. """ return int(1.0 * (time.time() + 0.5) * 1000) def gen_random_id() -> str: """gen_random_id. Generates a random unique id, using the uuid library. Args: Returns: str: String representation of the random unique id """ return str(uuid.uuid4()).replace('-', '')
21.2
69
0.588336
fdc3fc24cea107cba4ab6159b29d6bd76397bdc9
434
py
Python
Pratical/Class02/metodo_da_bissecao.py
JoaoCostaIFG/MNUM
6e042d8a6f64feb9eae9c79afec2fbab51f46fbd
[ "MIT" ]
1
2019-12-07T10:34:30.000Z
2019-12-07T10:34:30.000Z
Pratical/Class02/metodo_da_bissecao.py
JoaoCostaIFG/MNUM
6e042d8a6f64feb9eae9c79afec2fbab51f46fbd
[ "MIT" ]
null
null
null
Pratical/Class02/metodo_da_bissecao.py
JoaoCostaIFG/MNUM
6e042d8a6f64feb9eae9c79afec2fbab51f46fbd
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # Pesquisa binaria # Read num = int(input("Number to find the sqrt of? ")) index = 0 step = num / 2 prox = True while abs(index * index - num) > 1e-10: if (prox): index += step else: index -= step step = step / 2 if (index * index) < num: prox = True else: prox = False print("Result: [", index - 2 * step, ", ", index, "] with percision of +/-", step)
17.36
82
0.534562
fdc4efcf38d739230cb577df9971b45dd3d12756
2,625
py
Python
final/NerualNetworks/utils/MakeData.py
XuYi-fei/HUST-EIC-MathematicalModeling
73797bdba17d4f759be3a39603b42be081a98e5c
[ "MIT" ]
1
2021-05-04T12:29:21.000Z
2021-05-04T12:29:21.000Z
final/NerualNetworks/utils/MakeData.py
XuYi-fei/HUST-EIC-MathematicalModeling
73797bdba17d4f759be3a39603b42be081a98e5c
[ "MIT" ]
null
null
null
final/NerualNetworks/utils/MakeData.py
XuYi-fei/HUST-EIC-MathematicalModeling
73797bdba17d4f759be3a39603b42be081a98e5c
[ "MIT" ]
null
null
null
import pandas as pd import os import random if __name__ == '__main__': data = MakeDataset(path=r'D:\GitRepos\EIC\MathmaticalModeling\HUST-EIC-MathematicalModeling\final\NerualNetworks\Data\Preprocessed_original.xlsx')
34.090909
196
0.55619
fdc5979ebdcfef679c432bdc3659a7c209d59706
326
py
Python
chapter06/example612.py
yozw/lio-files
e036bc868207ec045a804495fc40cf3a48e37d6d
[ "MIT" ]
null
null
null
chapter06/example612.py
yozw/lio-files
e036bc868207ec045a804495fc40cf3a48e37d6d
[ "MIT" ]
null
null
null
chapter06/example612.py
yozw/lio-files
e036bc868207ec045a804495fc40cf3a48e37d6d
[ "MIT" ]
null
null
null
from math import sqrt from numpy import matrix from intpm import intpm A = matrix([[1, 0, 1, 0], [0, 1, 0, 1]]) b = matrix([1, 1]).T c = matrix([-1, -2, 0, 0]).T mu = 100 x1 = 0.5 * (-2 * mu + 1 + sqrt(1 + 4*mu*mu)) x2 = 0.5 * (-mu + 1 + sqrt(1 + mu * mu)) x0 = matrix([x1, x2, 1 - x1, 1 - x2]).T intpm(A, b, c, x0, mu)
18.111111
44
0.509202
fdc8a16130fbd3365668c8adfa036d8311ee21c2
2,205
py
Python
DataBase/Postgres/PostgresTest.py
InverseLina/python-practice
496d2020916d8096a32131cdedd25a4da7b7735e
[ "Apache-2.0" ]
null
null
null
DataBase/Postgres/PostgresTest.py
InverseLina/python-practice
496d2020916d8096a32131cdedd25a4da7b7735e
[ "Apache-2.0" ]
null
null
null
DataBase/Postgres/PostgresTest.py
InverseLina/python-practice
496d2020916d8096a32131cdedd25a4da7b7735e
[ "Apache-2.0" ]
null
null
null
import psycopg2 # encoding=utf-8 __author__ = 'Hinsteny' def select_data(conn): ''' :param conn: :return: ''' cur = conn.cursor() cur.execute("SELECT id, name, address, salary from COMPANY ORDER BY id ASC;") rows = cur.fetchall() for row in rows: print("ID = ", row[0]) print("NAME = ", row[1]) print("ADDRESS = ", row[2]) print("SALARY = ", row[3], "\n") print("Operation done successfully") conn.close() pass # Do test if __name__ == "__main__": create_table(get_conn()) insert_data(get_conn()) select_data(get_conn()) update_data(get_conn()) delete_data(get_conn()) pass
24.230769
116
0.579592
fdc9a425f145a01bd193481bd02f81259f33f97c
21,351
py
Python
pysnmp/DHCP-Server-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/DHCP-Server-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/DHCP-Server-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module DHCP-Server-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DHCP-SERVER-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 18:31:49 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, ObjectIdentifier, Integer = mibBuilder.importSymbols("ASN1", "OctetString", "ObjectIdentifier", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint") dlink_common_mgmt, = mibBuilder.importSymbols("DLINK-ID-REC-MIB", "dlink-common-mgmt") ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup") Gauge32, ModuleIdentity, Counter32, Counter64, ObjectIdentity, MibIdentifier, IpAddress, NotificationType, Unsigned32, MibScalar, MibTable, MibTableRow, MibTableColumn, Bits, Integer32, iso, TimeTicks = mibBuilder.importSymbols("SNMPv2-SMI", "Gauge32", "ModuleIdentity", "Counter32", "Counter64", "ObjectIdentity", "MibIdentifier", "IpAddress", "NotificationType", "Unsigned32", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Bits", "Integer32", "iso", "TimeTicks") TextualConvention, RowStatus, MacAddress, DisplayString = mibBuilder.importSymbols("SNMPv2-TC", "TextualConvention", "RowStatus", "MacAddress", "DisplayString") swDHCPServerMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 171, 12, 38)) if mibBuilder.loadTexts: swDHCPServerMIB.setLastUpdated('200706080000Z') if mibBuilder.loadTexts: swDHCPServerMIB.setOrganization('D-Link Crop.') swDHCPServerCtrl = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 1)) swDHCPServerInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 2)) swDHCPServerMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 3)) swDHCPServerPoolMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2)) swDHCPServerBindingMgmt = MibIdentifier((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4)) swDHCPServerState = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 38, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerState.setStatus('current') swDHCPServerPingPktNumber = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 38, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 10))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPingPktNumber.setStatus('current') swDHCPServerPingTimeOut = MibScalar((1, 3, 6, 1, 4, 1, 171, 12, 38, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(10, 2000))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPingTimeOut.setStatus('current') swDHCPServerExcludedAddressTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1), ) if mibBuilder.loadTexts: swDHCPServerExcludedAddressTable.setStatus('current') swDHCPServerExcludedAddressEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerExcludedAddressBegin"), (0, "DHCP-Server-MIB", "swDHCPServerExcludedAddressEnd")) if mibBuilder.loadTexts: swDHCPServerExcludedAddressEntry.setStatus('current') swDHCPServerExcludedAddressBegin = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerExcludedAddressBegin.setStatus('current') swDHCPServerExcludedAddressEnd = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerExcludedAddressEnd.setStatus('current') swDHCPServerExcludedAddressStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 1, 1, 3), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerExcludedAddressStatus.setStatus('current') swDHCPServerPoolTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1), ) if mibBuilder.loadTexts: swDHCPServerPoolTable.setStatus('current') swDHCPServerPoolEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerPoolName")) if mibBuilder.loadTexts: swDHCPServerPoolEntry.setStatus('current') swDHCPServerPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerPoolName.setStatus('current') swDHCPServerPoolNetworkAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 2), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNetworkAddress.setStatus('current') swDHCPServerPoolNetworkAddressMask = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNetworkAddressMask.setStatus('current') swDHCPServerPoolDomainName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 4), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolDomainName.setStatus('current') swDHCPServerPoolNetBIOSNodeType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("broadcast", 1), ("peer-to-peer", 2), ("mixed", 3), ("hybid", 4)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNetBIOSNodeType.setStatus('current') swDHCPServerPoolLeaseState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("predefined", 1), ("infinite", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseState.setStatus('current') swDHCPServerPoolLeaseDay = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 365))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseDay.setStatus('current') swDHCPServerPoolLeaseHour = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 23))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseHour.setStatus('current') swDHCPServerPoolLeaseMinute = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 59))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolLeaseMinute.setStatus('current') swDHCPServerPoolBootFile = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 10), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 64))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolBootFile.setStatus('current') swDHCPServerPoolNextServer = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 11), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerPoolNextServer.setStatus('current') swDHCPServerPoolStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 1, 1, 12), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerPoolStatus.setStatus('current') swDHCPServerDNSServerAddressTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2), ) if mibBuilder.loadTexts: swDHCPServerDNSServerAddressTable.setStatus('current') swDHCPServerDNSServerAddressEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerDNSServerPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerDNSServerAddressIndex")) if mibBuilder.loadTexts: swDHCPServerDNSServerAddressEntry.setStatus('current') swDHCPServerDNSServerPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDNSServerPoolName.setStatus('current') swDHCPServerDNSServerAddressIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDNSServerAddressIndex.setStatus('current') swDHCPServerDNSServerAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerDNSServerAddress.setStatus('current') swDHCPServerDNSServerAddressStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 2, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerDNSServerAddressStatus.setStatus('current') swDHCPServerNetBIOSNameServerTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3), ) if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerTable.setStatus('current') swDHCPServerNetBIOSNameServerEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerNetBIOSNameServerPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerNetBIOSNameServerIndex")) if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerEntry.setStatus('current') swDHCPServerNetBIOSNameServerPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerPoolName.setStatus('current') swDHCPServerNetBIOSNameServerIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerIndex.setStatus('current') swDHCPServerNetBIOSNameServer = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServer.setStatus('current') swDHCPServerNetBIOSNameServerStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 3, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerNetBIOSNameServerStatus.setStatus('current') swDHCPServerDefaultRouterTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4), ) if mibBuilder.loadTexts: swDHCPServerDefaultRouterTable.setStatus('current') swDHCPServerDefaultRouterEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerDefaultRouterPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerDefaultRouterIndex")) if mibBuilder.loadTexts: swDHCPServerDefaultRouterEntry.setStatus('current') swDHCPServerDefaultRouterPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDefaultRouterPoolName.setStatus('current') swDHCPServerDefaultRouterIndex = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 2), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerDefaultRouterIndex.setStatus('current') swDHCPServerDefaultRouter = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 3), IpAddress()).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerDefaultRouter.setStatus('current') swDHCPServerDefaultRouterStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 2, 4, 1, 4), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerDefaultRouterStatus.setStatus('current') swDHCPServerManualBindingTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3), ) if mibBuilder.loadTexts: swDHCPServerManualBindingTable.setStatus('current') swDHCPServerManualBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerManualBindingPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerManualBindingIpAddress")) if mibBuilder.loadTexts: swDHCPServerManualBindingEntry.setStatus('current') swDHCPServerManualBindingPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerManualBindingPoolName.setStatus('current') swDHCPServerManualBindingIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerManualBindingIpAddress.setStatus('current') swDHCPServerManualBindingHardwareAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 3), MacAddress()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerManualBindingHardwareAddress.setStatus('current') swDHCPServerManualBindingType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3))).clone(namedValues=NamedValues(("ethernet", 1), ("ieee802", 2), ("both", 3)))).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerManualBindingType.setStatus('current') swDHCPServerManualBindingStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 3, 1, 5), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: swDHCPServerManualBindingStatus.setStatus('current') swDHCPServerBindingTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4), ) if mibBuilder.loadTexts: swDHCPServerBindingTable.setStatus('current') swDHCPServerBindingEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerBindingPoolName"), (0, "DHCP-Server-MIB", "swDHCPServerBindingIpAddress")) if mibBuilder.loadTexts: swDHCPServerBindingEntry.setStatus('current') swDHCPServerBindingPoolName = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 1), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 12))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingPoolName.setStatus('current') swDHCPServerBindingIpAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 2), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingIpAddress.setStatus('current') swDHCPServerBindingHardwareAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 3), MacAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingHardwareAddress.setStatus('current') swDHCPServerBindingType = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ethernet", 1), ("iee802", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingType.setStatus('current') swDHCPServerBindingStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 5), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("manual", 1), ("automatic", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingStatus.setStatus('current') swDHCPServerBindingLifeTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 6), Integer32()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerBindingLifeTime.setStatus('current') swDHCPServerBindingClearState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 4, 1, 7), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("none", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerBindingClearState.setStatus('current') swDHCPServerConflictIPTable = MibTable((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5), ) if mibBuilder.loadTexts: swDHCPServerConflictIPTable.setStatus('current') swDHCPServerConflictIPEntry = MibTableRow((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1), ).setIndexNames((0, "DHCP-Server-MIB", "swDHCPServerConflictIPIPAddress")) if mibBuilder.loadTexts: swDHCPServerConflictIPEntry.setStatus('current') swDHCPServerConflictIPIPAddress = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 1), IpAddress()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerConflictIPIPAddress.setStatus('current') swDHCPServerConflictIPDetectionMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("ping", 1), ("gratuitous-arp", 2)))).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerConflictIPDetectionMethod.setStatus('current') swDHCPServerConflictIPDetectionTime = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 3), DisplayString()).setMaxAccess("readonly") if mibBuilder.loadTexts: swDHCPServerConflictIPDetectionTime.setStatus('current') swDHCPServerConflictIPClearState = MibTableColumn((1, 3, 6, 1, 4, 1, 171, 12, 38, 3, 5, 1, 4), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("none", 1), ("start", 2)))).setMaxAccess("readwrite") if mibBuilder.loadTexts: swDHCPServerConflictIPClearState.setStatus('current') mibBuilder.exportSymbols("DHCP-Server-MIB", swDHCPServerPoolName=swDHCPServerPoolName, swDHCPServerExcludedAddressEntry=swDHCPServerExcludedAddressEntry, swDHCPServerExcludedAddressEnd=swDHCPServerExcludedAddressEnd, swDHCPServerBindingMgmt=swDHCPServerBindingMgmt, swDHCPServerNetBIOSNameServerIndex=swDHCPServerNetBIOSNameServerIndex, swDHCPServerPoolTable=swDHCPServerPoolTable, swDHCPServerDefaultRouterStatus=swDHCPServerDefaultRouterStatus, swDHCPServerPoolNetBIOSNodeType=swDHCPServerPoolNetBIOSNodeType, swDHCPServerPoolLeaseState=swDHCPServerPoolLeaseState, swDHCPServerDefaultRouterTable=swDHCPServerDefaultRouterTable, swDHCPServerManualBindingTable=swDHCPServerManualBindingTable, swDHCPServerBindingLifeTime=swDHCPServerBindingLifeTime, swDHCPServerManualBindingType=swDHCPServerManualBindingType, swDHCPServerDNSServerAddress=swDHCPServerDNSServerAddress, swDHCPServerDefaultRouterIndex=swDHCPServerDefaultRouterIndex, swDHCPServerConflictIPTable=swDHCPServerConflictIPTable, swDHCPServerBindingPoolName=swDHCPServerBindingPoolName, swDHCPServerPingTimeOut=swDHCPServerPingTimeOut, swDHCPServerExcludedAddressBegin=swDHCPServerExcludedAddressBegin, swDHCPServerPoolMgmt=swDHCPServerPoolMgmt, swDHCPServerNetBIOSNameServerTable=swDHCPServerNetBIOSNameServerTable, swDHCPServerConflictIPDetectionMethod=swDHCPServerConflictIPDetectionMethod, swDHCPServerNetBIOSNameServerEntry=swDHCPServerNetBIOSNameServerEntry, swDHCPServerExcludedAddressTable=swDHCPServerExcludedAddressTable, swDHCPServerPoolNetworkAddressMask=swDHCPServerPoolNetworkAddressMask, swDHCPServerDNSServerAddressTable=swDHCPServerDNSServerAddressTable, swDHCPServerExcludedAddressStatus=swDHCPServerExcludedAddressStatus, swDHCPServerPingPktNumber=swDHCPServerPingPktNumber, swDHCPServerMgmt=swDHCPServerMgmt, swDHCPServerNetBIOSNameServerPoolName=swDHCPServerNetBIOSNameServerPoolName, swDHCPServerDefaultRouterEntry=swDHCPServerDefaultRouterEntry, swDHCPServerBindingEntry=swDHCPServerBindingEntry, swDHCPServerManualBindingPoolName=swDHCPServerManualBindingPoolName, swDHCPServerDefaultRouter=swDHCPServerDefaultRouter, swDHCPServerManualBindingHardwareAddress=swDHCPServerManualBindingHardwareAddress, swDHCPServerPoolLeaseMinute=swDHCPServerPoolLeaseMinute, swDHCPServerBindingType=swDHCPServerBindingType, swDHCPServerBindingClearState=swDHCPServerBindingClearState, swDHCPServerDNSServerPoolName=swDHCPServerDNSServerPoolName, swDHCPServerManualBindingIpAddress=swDHCPServerManualBindingIpAddress, swDHCPServerBindingHardwareAddress=swDHCPServerBindingHardwareAddress, swDHCPServerConflictIPEntry=swDHCPServerConflictIPEntry, swDHCPServerInfo=swDHCPServerInfo, swDHCPServerState=swDHCPServerState, PYSNMP_MODULE_ID=swDHCPServerMIB, swDHCPServerCtrl=swDHCPServerCtrl, swDHCPServerPoolLeaseHour=swDHCPServerPoolLeaseHour, swDHCPServerDNSServerAddressEntry=swDHCPServerDNSServerAddressEntry, swDHCPServerNetBIOSNameServer=swDHCPServerNetBIOSNameServer, swDHCPServerBindingIpAddress=swDHCPServerBindingIpAddress, swDHCPServerBindingStatus=swDHCPServerBindingStatus, swDHCPServerPoolBootFile=swDHCPServerPoolBootFile, swDHCPServerPoolStatus=swDHCPServerPoolStatus, swDHCPServerPoolDomainName=swDHCPServerPoolDomainName, swDHCPServerManualBindingEntry=swDHCPServerManualBindingEntry, swDHCPServerConflictIPClearState=swDHCPServerConflictIPClearState, swDHCPServerBindingTable=swDHCPServerBindingTable, swDHCPServerManualBindingStatus=swDHCPServerManualBindingStatus, swDHCPServerMIB=swDHCPServerMIB, swDHCPServerPoolNextServer=swDHCPServerPoolNextServer, swDHCPServerConflictIPIPAddress=swDHCPServerConflictIPIPAddress, swDHCPServerNetBIOSNameServerStatus=swDHCPServerNetBIOSNameServerStatus, swDHCPServerDNSServerAddressStatus=swDHCPServerDNSServerAddressStatus, swDHCPServerDefaultRouterPoolName=swDHCPServerDefaultRouterPoolName, swDHCPServerPoolEntry=swDHCPServerPoolEntry, swDHCPServerPoolNetworkAddress=swDHCPServerPoolNetworkAddress, swDHCPServerPoolLeaseDay=swDHCPServerPoolLeaseDay, swDHCPServerConflictIPDetectionTime=swDHCPServerConflictIPDetectionTime, swDHCPServerDNSServerAddressIndex=swDHCPServerDNSServerAddressIndex)
144.263514
4,113
0.793405
fdcd1b4c925a7d033b9a81f8136657b169b6bcf9
1,603
py
Python
example_convert_dataset.py
fadamsyah/cv_utils
487fc65fe4a71f05dd03df31cde21d866968c0b4
[ "MIT" ]
null
null
null
example_convert_dataset.py
fadamsyah/cv_utils
487fc65fe4a71f05dd03df31cde21d866968c0b4
[ "MIT" ]
1
2021-11-01T06:10:29.000Z
2021-11-09T12:47:48.000Z
example_convert_dataset.py
fadamsyah/cv_utils
487fc65fe4a71f05dd03df31cde21d866968c0b4
[ "MIT" ]
null
null
null
from cv_utils.object_detection.dataset.converter import coco_to_yolo from cv_utils.object_detection.dataset.converter import yolo_to_coco ''' COCO --> YOLO This code uses the ultralytics/yolov5 format. The converted dataset will be saved as follow: - {output_folder} - images - {output_set_name} - {image_1} - {image_2} - ... - labels - {output_set_name} - {image_1} - {image_2} - ... - classes.txt ''' for set_name in ["train", "test", "val"]: coco_to_yolo( coco_annotation_path = f"demo/dataset/fasciola_ori/annotations/instances_{set_name}.json", coco_image_dir = f"demo/dataset/fasciola_ori/{set_name}", output_image_dir = f"demo/dataset/fasciola_yolo/images/{set_name}", output_label_dir = f"demo/dataset/fasciola_yolo/labels/{set_name}", output_category_path = f"demo/dataset/fasciola_yolo/classes.txt" ) '''YOLO --> COCO This code uses the ultralytics/yolov5 format: - {yolo_image_dir} - {image_1} - {image_2} - ... - {yolo_label_dir} - {image_1} - {image_2} - ... ''' for set_name in ["train", "test", "val"]: yolo_to_coco( yolo_image_dir = f"demo/dataset/fasciola_yolo/images/{set_name}", yolo_label_dir = f"demo/dataset/fasciola_yolo/labels/{set_name}", yolo_class_file = "demo/dataset/fasciola_yolo/classes.txt", coco_image_dir = f"demo/dataset/fasciola_coco/{set_name}", coco_annotation_path = f"demo/dataset/fasciola_coco/annotations/instances_{set_name}.json" )
32.714286
98
0.651903
fdcf6f1f635a8225a76ad32f552e3db603ad1c14
2,369
py
Python
jobs/api/models/keyword.py
gitdaniel228/jobSearch
5dc1c69a3750f92ca0bcd378dfdc500143204a5a
[ "MIT" ]
null
null
null
jobs/api/models/keyword.py
gitdaniel228/jobSearch
5dc1c69a3750f92ca0bcd378dfdc500143204a5a
[ "MIT" ]
null
null
null
jobs/api/models/keyword.py
gitdaniel228/jobSearch
5dc1c69a3750f92ca0bcd378dfdc500143204a5a
[ "MIT" ]
null
null
null
from django.db import models from django.contrib import admin from .country import Country from .filter import Filter from .setting import Setting from .site import Site
31.171053
78
0.594344
fdd4d7c9ea8afe2d857b858645122b0c43587a2f
4,262
py
Python
test/units/plugins/inventory/test_script.py
Container-Projects/ansible-provider-docs
100b695b0b0c4d8d08af362069557ffc735d0d7e
[ "PSF-2.0", "BSD-2-Clause", "MIT" ]
37
2017-08-15T15:02:43.000Z
2021-07-23T03:44:31.000Z
test/units/plugins/inventory/test_script.py
Container-Projects/ansible-provider-docs
100b695b0b0c4d8d08af362069557ffc735d0d7e
[ "PSF-2.0", "BSD-2-Clause", "MIT" ]
12
2018-01-10T05:25:25.000Z
2021-11-28T06:55:48.000Z
test/units/plugins/inventory/test_script.py
Container-Projects/ansible-provider-docs
100b695b0b0c4d8d08af362069557ffc735d0d7e
[ "PSF-2.0", "BSD-2-Clause", "MIT" ]
49
2017-08-15T09:52:13.000Z
2022-03-21T17:11:54.000Z
# -*- coding: utf-8 -*- # Copyright 2017 Chris Meyers <cmeyers@ansible.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible 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 Ansible. If not, see <http://www.gnu.org/licenses/>. # Make coding more python3-ish from __future__ import (absolute_import, division, print_function) __metaclass__ = type import pytest from ansible import constants as C from ansible.errors import AnsibleError from ansible.plugins.loader import PluginLoader from ansible.compat.tests import mock from ansible.compat.tests import unittest from ansible.module_utils._text import to_bytes, to_native
40.207547
135
0.680432
fdd740c29776fedc99f0ae3abe771a8f8e0fe2b3
2,781
py
Python
app/routes.py
volvo007/flask_microblog
b826bcaa4fec6703a66f757e39fdf1fcced031f9
[ "Apache-2.0" ]
null
null
null
app/routes.py
volvo007/flask_microblog
b826bcaa4fec6703a66f757e39fdf1fcced031f9
[ "Apache-2.0" ]
null
null
null
app/routes.py
volvo007/flask_microblog
b826bcaa4fec6703a66f757e39fdf1fcced031f9
[ "Apache-2.0" ]
null
null
null
import time from flask import render_template, flash, redirect, url_for from flask.globals import request from flask_login.utils import logout_user from werkzeug.urls import url_parse # from flask.helpers import flash # from app import app, db # app initapp from app.forms import LoginForm, RegistrationForm from flask_login import current_user, login_user, login_required from app.models import User
37.08
82
0.647609
fdda757521b551e07a7f4e98103818cc6dd32745
10,501
py
Python
asr_deepspeech/modules/deepspeech.py
shangdibufashi/ASRDeepSpeech
f11134abb79e98062fbc25fab99ca4cf675e538b
[ "MIT" ]
44
2020-03-03T13:05:57.000Z
2022-03-24T03:42:31.000Z
asr_deepspeech/modules/deepspeech.py
shangdibufashi/ASRDeepSpeech
f11134abb79e98062fbc25fab99ca4cf675e538b
[ "MIT" ]
6
2020-12-15T10:58:19.000Z
2021-10-12T01:59:17.000Z
asr_deepspeech/modules/deepspeech.py
shangdibufashi/ASRDeepSpeech
f11134abb79e98062fbc25fab99ca4cf675e538b
[ "MIT" ]
13
2020-05-20T06:42:20.000Z
2022-03-24T03:42:31.000Z
import math from collections import OrderedDict import json from asr_deepspeech.decoders import GreedyDecoder import os from ascii_graph import Pyasciigraph from asr_deepspeech.data.loaders import AudioDataLoader from asr_deepspeech.data.samplers import BucketingSampler from .blocks import * from asr_deepspeech.data.dataset import SpectrogramDataset from argparse import Namespace from zakuro import hub
42.172691
119
0.517475
fddb07c49fca7dc8739e0a7542a2263412a966ed
179
py
Python
ao2j/lt1300/046/B.py
neshdev/competitive-prog
f406a85d62e83c3dbd3ad41f42ae121ebefd0fda
[ "MIT" ]
null
null
null
ao2j/lt1300/046/B.py
neshdev/competitive-prog
f406a85d62e83c3dbd3ad41f42ae121ebefd0fda
[ "MIT" ]
null
null
null
ao2j/lt1300/046/B.py
neshdev/competitive-prog
f406a85d62e83c3dbd3ad41f42ae121ebefd0fda
[ "MIT" ]
null
null
null
n,k = [int(x) for x in input().split()] arr = [int(x) for x in input().split()] arr.sort() total = 0 for i in range(k): if arr[i] < 0: total += -arr[i] print(total)
16.272727
39
0.536313
fddb0cd219604b7758190e6bb17c4dc60b79a754
1,099
py
Python
Scripts/simulation/ensemble/ensemble_interactions.py
velocist/TS4CheatsInfo
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
[ "Apache-2.0" ]
null
null
null
Scripts/simulation/ensemble/ensemble_interactions.py
velocist/TS4CheatsInfo
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
[ "Apache-2.0" ]
null
null
null
Scripts/simulation/ensemble/ensemble_interactions.py
velocist/TS4CheatsInfo
b59ea7e5f4bd01d3b3bd7603843d525a9c179867
[ "Apache-2.0" ]
null
null
null
# uncompyle6 version 3.7.4 # Python bytecode 3.7 (3394) # Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] # Embedded file name: T:\InGame\Gameplay\Scripts\Server\ensemble\ensemble_interactions.py # Compiled at: 2016-07-13 03:28:12 # Size of source mod 2**32: 1070 bytes from objects.base_interactions import ProxyInteraction from sims4.utils import classproperty, flexmethod
37.896552
107
0.724295
fddc8823ffb3b416234d50c4b32a14d5668ecba6
1,663
py
Python
icmpv6socket/__init__.py
TheDiveO/icmpv6-socket
fe3ee52e6793e3739975aea87e2b6511be96fa12
[ "Apache-2.0" ]
null
null
null
icmpv6socket/__init__.py
TheDiveO/icmpv6-socket
fe3ee52e6793e3739975aea87e2b6511be96fa12
[ "Apache-2.0" ]
null
null
null
icmpv6socket/__init__.py
TheDiveO/icmpv6-socket
fe3ee52e6793e3739975aea87e2b6511be96fa12
[ "Apache-2.0" ]
null
null
null
import socket from typing import Optional, List __version__ = '0.1.0'
36.955556
89
0.615755
fddd39b69360c06e6b24844fb2887dcd6cf29f89
603
py
Python
game/pkchess/res/map.py
RaenonX/Jelly-Bot-API
c7da1e91783dce3a2b71b955b3a22b68db9056cf
[ "MIT" ]
5
2020-08-26T20:12:00.000Z
2020-12-11T16:39:22.000Z
game/pkchess/res/map.py
RaenonX/Jelly-Bot
c7da1e91783dce3a2b71b955b3a22b68db9056cf
[ "MIT" ]
234
2019-12-14T03:45:19.000Z
2020-08-26T18:55:19.000Z
game/pkchess/res/map.py
RaenonX/Jelly-Bot-API
c7da1e91783dce3a2b71b955b3a22b68db9056cf
[ "MIT" ]
2
2019-10-23T15:21:15.000Z
2020-05-22T09:35:55.000Z
"""Game map resource manager.""" __all__ = ("get_map_template",) _cache = {} def get_map_template(name: str): """ Get a map template by its ``name``. Returns ``None`` if not found. Loaded :class:`MapTemplate` will be cached until the application exits. :param name: name of the map template. :return: map template object if found """ if name not in _cache: # On-demand import & avoid circular import from game.pkchess.map import MapTemplate _cache[name] = MapTemplate.load_from_file(f"game/pkchess/res/map/{name}") return _cache[name]
24.12
81
0.658375
fddd3e193fe076cab7c0cf9457a9b99d97220113
248
py
Python
example/main_01.py
janothan/Evaluation-Framework
e53847bc352f657953933e1d7c97b68ac890c852
[ "Apache-2.0" ]
5
2020-02-12T13:11:14.000Z
2021-01-28T12:45:22.000Z
example/main_01.py
charyeezy/Evaluation-Framework
ddfd4ea654a3d7d2abd58f062ec98a8a736f8f51
[ "Apache-2.0" ]
9
2019-07-29T17:45:30.000Z
2022-03-17T12:24:47.000Z
example/main_01.py
charyeezy/Evaluation-Framework
ddfd4ea654a3d7d2abd58f062ec98a8a736f8f51
[ "Apache-2.0" ]
7
2020-02-12T13:22:49.000Z
2021-11-29T01:08:50.000Z
from evaluation_framework.manager import FrameworkManager if __name__ == "__main__": evaluation_manager = FrameworkManager() evaluation_manager.evaluate( "objectFrequencyS.h5", vector_file_format="hdf5", debugging_mode=False )
31
78
0.766129
fddd8f9fba011d6c4a116c9eb70ffe36d73e109e
7,127
py
Python
public_data/views.py
danamlewis/open-humans
9b08310cf151f49032b66ddd005bbd47d466cc4e
[ "MIT" ]
57
2016-09-01T21:55:52.000Z
2022-03-27T22:15:32.000Z
public_data/views.py
danamlewis/open-humans
9b08310cf151f49032b66ddd005bbd47d466cc4e
[ "MIT" ]
464
2015-03-23T18:08:28.000Z
2016-08-25T04:57:36.000Z
public_data/views.py
danamlewis/open-humans
9b08310cf151f49032b66ddd005bbd47d466cc4e
[ "MIT" ]
25
2017-01-24T16:23:27.000Z
2021-11-07T01:51:42.000Z
from django.conf import settings from django.contrib import messages as django_messages from django.urls import reverse_lazy from django.utils.decorators import method_decorator from django.views.decorators.http import require_POST from django.views.generic.base import RedirectView, TemplateView from django.views.generic.edit import CreateView, FormView from raven.contrib.django.raven_compat.models import client as raven_client from common.mixins import PrivateMixin from common.utils import get_source_labels from private_sharing.models import ( ActivityFeed, DataRequestProject, DataRequestProjectMember, id_label_to_project, ) from .forms import ConsentForm from .models import PublicDataAccess, WithdrawalFeedback
30.852814
88
0.638698
fddf95ac612e69b154ea7fc28a7e99daf0730fea
685
py
Python
UserAlgorithm.py
Anirudhsfc/RunTimeAlgo
eb0fb706b4c738bad603327a94c9724e3dfe8fee
[ "MIT" ]
1
2019-09-03T08:28:26.000Z
2019-09-03T08:28:26.000Z
UserAlgorithm.py
Anirudhsfc/RunTimeAlgo
eb0fb706b4c738bad603327a94c9724e3dfe8fee
[ "MIT" ]
null
null
null
UserAlgorithm.py
Anirudhsfc/RunTimeAlgo
eb0fb706b4c738bad603327a94c9724e3dfe8fee
[ "MIT" ]
null
null
null
from MakeYourOwnGraph import * #user needs to import this line GraphOfMyAlgo(F1,2,[1,30,2,31]) #user needs to execute this line in his or her algorithm where the first argument is the name of the Algorithm Function, here F1 #the Second argument is the number of arguments that the algorithm of the user inputs #the third argument is an array of ranges, namely beginning value of range, ending value of range_for_first_argument, beginning value of range_for_second_argument, ending value of range_for_second_argument and so on
52.692308
247
0.681752
fde563740923e926b86419c22eb43be2e6e526e1
38
py
Python
robopilot/pipeline/__init__.py
robotory/robopilot
e10207b66d06e5d169f890d1d7e57d971ca1eb5d
[ "MIT" ]
null
null
null
robopilot/pipeline/__init__.py
robotory/robopilot
e10207b66d06e5d169f890d1d7e57d971ca1eb5d
[ "MIT" ]
null
null
null
robopilot/pipeline/__init__.py
robotory/robopilot
e10207b66d06e5d169f890d1d7e57d971ca1eb5d
[ "MIT" ]
null
null
null
# The new robopilot training pipeline.
38
38
0.815789
fde56cf34b5e2c673b4f1db2a825702a705cb407
1,257
py
Python
dsRenamingTool/dialogBase.py
S0nic014/dsRenamingTool
97efcd660af820ab6b5f1918222ba31a95d47788
[ "MIT" ]
2
2020-07-15T16:59:31.000Z
2021-08-17T14:04:15.000Z
dsRenamingTool/dialogBase.py
S0nic014/dsRenamingTool
97efcd660af820ab6b5f1918222ba31a95d47788
[ "MIT" ]
null
null
null
dsRenamingTool/dialogBase.py
S0nic014/dsRenamingTool
97efcd660af820ab6b5f1918222ba31a95d47788
[ "MIT" ]
null
null
null
import sys from PySide2 import QtCore from PySide2 import QtWidgets from shiboken2 import wrapInstance import maya.OpenMayaUI as omui def mayaMainWindow(): """ Get maya main window as QWidget :return: Maya main window as QWidget :rtype: PySide2.QtWidgets.QWidget """ mainWindowPtr = omui.MQtUtil.mainWindow() if mainWindowPtr: if sys.version_info[0] < 3: return wrapInstance(long(mainWindowPtr), QtWidgets.QWidget) # noqa: F821 else: return wrapInstance(int(mainWindowPtr), QtWidgets.QWidget) else: mayaMainWindow()
24.647059
87
0.668258
fde68e690db6e169850d5ee88a2ba6ad82e43a9a
853
py
Python
beyondtheadmin/invoices/templatetags/fullurl.py
gfavre/invoice-manager
2a1db22edd51b461c090282c6fc1f290f3265379
[ "MIT" ]
1
2021-11-27T06:40:34.000Z
2021-11-27T06:40:34.000Z
beyondtheadmin/invoices/templatetags/fullurl.py
gfavre/invoice-manager
2a1db22edd51b461c090282c6fc1f290f3265379
[ "MIT" ]
2
2021-05-13T04:50:50.000Z
2022-02-28T21:06:24.000Z
beyondtheadmin/invoices/templatetags/fullurl.py
gfavre/invoice-manager
2a1db22edd51b461c090282c6fc1f290f3265379
[ "MIT" ]
null
null
null
import math from django import template from django.utils.safestring import mark_safe register = template.Library()
26.65625
106
0.637749
fde73e6cb304ab68d07ceb772b316e170a4014cb
967
py
Python
big_o_project/Task4.py
CTylerD/Data-Structures-Algorithms-Projects
e72248a6433c0242003edf404a715d9f53e3792d
[ "MIT" ]
null
null
null
big_o_project/Task4.py
CTylerD/Data-Structures-Algorithms-Projects
e72248a6433c0242003edf404a715d9f53e3792d
[ "MIT" ]
null
null
null
big_o_project/Task4.py
CTylerD/Data-Structures-Algorithms-Projects
e72248a6433c0242003edf404a715d9f53e3792d
[ "MIT" ]
null
null
null
import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) create_lists_of_users()
26.861111
69
0.709411
fde75eeec45ccf538859617be8047b6998c73dee
971
py
Python
codingstars/platinum3/subarray-sum2.py
yehyunchoi/Algorithm
35e32159ee13b46b30b543fa79ab6e81d6719f13
[ "MIT" ]
null
null
null
codingstars/platinum3/subarray-sum2.py
yehyunchoi/Algorithm
35e32159ee13b46b30b543fa79ab6e81d6719f13
[ "MIT" ]
null
null
null
codingstars/platinum3/subarray-sum2.py
yehyunchoi/Algorithm
35e32159ee13b46b30b543fa79ab6e81d6719f13
[ "MIT" ]
null
null
null
""" [1,2,3,4] 16 . [] [1] [1, 2] [1, 2, 3] [1, 2, 3, 4] [1, 2, 4] [1, 3] [1, 3, 4] [1, 4] [2] [2, 3] [2, 3, 4] [2, 4] [3] [3, 4] [4] blank list([]) 0 (subarray sum) 80. , . Input . . Output . Sample Input 1 3 26 -14 12 4 -2 Sample Output 1 928 """ ###################### # sorting step makes it very hard when it comes to computation time. # infact, it wasn't the sorting -- it was the range(n) --> range(i, n) that made a difference # different approach: # just sum it as you iterate arr = list(map(int, input().split())) n = len(arr) total = 0 subarraySum() print(total)
15.412698
93
0.582904
fde7b9b224da23bd030fbd50ece0e5433d5c208e
1,683
py
Python
fastalite/__main__.py
nhoffman/fastalite
2571c126976f26c8ca06401586559f288245ca8d
[ "MIT" ]
2
2017-02-16T14:30:18.000Z
2019-10-03T19:20:57.000Z
fastalite/__main__.py
nhoffman/fastalite
2571c126976f26c8ca06401586559f288245ca8d
[ "MIT" ]
4
2017-06-30T14:05:08.000Z
2022-02-17T00:03:28.000Z
fastalite/__main__.py
nhoffman/fastalite
2571c126976f26c8ca06401586559f288245ca8d
[ "MIT" ]
null
null
null
"""Command line interface to the fastlite package """ import sys import argparse from .fastalite import fastalite, fastqlite, Opener from . import __version__ if __name__ == '__main__': sys.exit(main(sys.argv[1:]))
28.525424
67
0.572193
fde8def0c521fe98b37b37c32684b2ac7afe4bd0
142
py
Python
music/class_/audioa/_mode/major.py
jedhsu/music
dea68c4a82296cd4910e786f533b2cbf861377c3
[ "MIT" ]
null
null
null
music/class_/audioa/_mode/major.py
jedhsu/music
dea68c4a82296cd4910e786f533b2cbf861377c3
[ "MIT" ]
null
null
null
music/class_/audioa/_mode/major.py
jedhsu/music
dea68c4a82296cd4910e786f533b2cbf861377c3
[ "MIT" ]
null
null
null
""" *Major Key* """ from abc import ABCMeta from ._key import ModedKey
8.875
27
0.640845
fdeadae2e6055ffb652fbc50ce8253522e83b82c
151
py
Python
bb_clients/__init__.py
voglster/ims_client
34021dd81fcc0196eb2fb23820571b766a50aaa7
[ "MIT" ]
null
null
null
bb_clients/__init__.py
voglster/ims_client
34021dd81fcc0196eb2fb23820571b766a50aaa7
[ "MIT" ]
null
null
null
bb_clients/__init__.py
voglster/ims_client
34021dd81fcc0196eb2fb23820571b766a50aaa7
[ "MIT" ]
null
null
null
"""Simple python clients for the Gravitate BestBuy Services""" __version__ = "0.1.18" from .fc import get_fc_service from .ims import get_ims_service
25.166667
62
0.781457
fdeb572c08b15704dfb038c3b7db65f44b06027a
9,482
py
Python
RpgPiratesAndFishers/Individual.py
LucasRR94/RPG_Pirates_and_Fishers
75bbb57e916f7a878de34676b1d988e5d2506121
[ "Apache-2.0" ]
null
null
null
RpgPiratesAndFishers/Individual.py
LucasRR94/RPG_Pirates_and_Fishers
75bbb57e916f7a878de34676b1d988e5d2506121
[ "Apache-2.0" ]
null
null
null
RpgPiratesAndFishers/Individual.py
LucasRR94/RPG_Pirates_and_Fishers
75bbb57e916f7a878de34676b1d988e5d2506121
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/python3 # -*- coding: utf-8 -*- from libGamePiratesAndFishers import assertIfIsWeelFormat,makeSureThatIsnumberLimited
25.489247
341
0.665999
fdedc1899cf1d0a458c3cd2aa54431d61028feb7
1,544
py
Python
08_apples_and_bananas/apples.py
FabrizioPe/tiny_python_projects
e130d55d36cac43496a8ad482b6159234b5122f3
[ "MIT" ]
null
null
null
08_apples_and_bananas/apples.py
FabrizioPe/tiny_python_projects
e130d55d36cac43496a8ad482b6159234b5122f3
[ "MIT" ]
null
null
null
08_apples_and_bananas/apples.py
FabrizioPe/tiny_python_projects
e130d55d36cac43496a8ad482b6159234b5122f3
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 """ Author : FabrizioPe Date : 2021-02-10 Purpose: Find and replace vowels in a given text """ import argparse import os # -------------------------------------------------- def get_args(): """Get command-line arguments""" parser = argparse.ArgumentParser( description='Apples and bananas', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('str', metavar='str', help='Input text or file') parser.add_argument('-v', '--vowel', help='The vowel to substitute', metavar='str', choices='aeiou', type=str, default='a') args = parser.parse_args() # but will this file remain open? if os.path.isfile(args.str): args.str = open(args.str).read().rstrip() return args # -------------------------------------------------- def main(): """Make a jazz noise here""" args = get_args() text = args.str vowel = args.vowel table = {'a': vowel, 'e': vowel, 'i': vowel, 'o': vowel, 'u': vowel, 'A': vowel.upper(), 'E': vowel.upper(), 'I': vowel.upper(), 'O': vowel.upper(), 'U': vowel.upper()} # apply the transformation defined in the table, to the input text print(text.translate(str.maketrans(table))) # -------------------------------------------------- if __name__ == '__main__': main()
26.169492
72
0.483808
fdedd48ecc2cd5713a5620f6663699573feeb1b9
1,434
py
Python
utils.py
gabrs-sousa/brasil-rugby-ranking
78b8f6b466e688f507cb9d97dbbb80442f3c67de
[ "MIT" ]
1
2020-05-30T03:34:31.000Z
2020-05-30T03:34:31.000Z
utils.py
gabrs-sousa/brasil-rugby-ranking
78b8f6b466e688f507cb9d97dbbb80442f3c67de
[ "MIT" ]
null
null
null
utils.py
gabrs-sousa/brasil-rugby-ranking
78b8f6b466e688f507cb9d97dbbb80442f3c67de
[ "MIT" ]
null
null
null
import pandas as pd from openpyxl import worksheet def format_name(name: str) -> str: """ Limpa espaos antes e depois da palavra Nome em caps lock para evitar case sensitive """ name = name.strip() name = name.upper() return name
28.117647
74
0.679916
fdee1b940008dee7fb0abcb8d4fb0eaf97c8d578
8,889
py
Python
mainapp/views.py
AHTOH2001/OOP_4_term
c9b0f64f3507486e0670cc95d7252862b673d845
[ "MIT" ]
null
null
null
mainapp/views.py
AHTOH2001/OOP_4_term
c9b0f64f3507486e0670cc95d7252862b673d845
[ "MIT" ]
null
null
null
mainapp/views.py
AHTOH2001/OOP_4_term
c9b0f64f3507486e0670cc95d7252862b673d845
[ "MIT" ]
null
null
null
from django.core.mail import send_mail from django.http import Http404 from django.shortcuts import render, redirect from django.contrib import messages from django.contrib.auth.models import User from django.utils.datastructures import MultiValueDictKeyError from django.utils import timezone from django.contrib.auth import login, logout from django import urls import copy # from django.contrib.auth.hashers import make_password, check_password, is_password_usable # from datetime import datetime from django.views.generic import DetailView from CheekLit import settings from .utils import get_code, is_administrator, should_show_price from .models import Client, Book, Author, Genre, Basket, Status, SliderImages from .forms import ClientRegisterForm, ClientAuthorizationForm from .settings import time_for_registration # class BookDetailView(DetailView): # queryset = Book.objects.all() # model = Book # context_object_name = 'book' # template_name = 'book_detail.html' # slug_url_kwarg = 'slug' # # def post(self, request, *args, **kwargs): # pass # # context = super().get_context_data(object=self.object) # # return super().render_to_response(context) def register(request): if request.method == 'POST': form = ClientRegisterForm(data=request.POST) if form.is_valid(): client, raw_pass = form.save() confirmation_url = request.META["HTTP_HOST"] + urls.reverse( register_complete) + f'?login={client.user.email}&code={get_code(client.user.email, "abs", 20)}' email_message = f''', {client.user.last_name} {client.user.first_name}! CheekLit. : : {client.user.email} : {raw_pass} ! ! : {confirmation_url} , , {(timezone.localtime() + time_for_registration).strftime('%H:%M %d.%m.%Y')}. . , CheekLit''' send_mail( f' {request.META["HTTP_HOST"]}', email_message, 'CheekLitBot@gmail.com', [client.user.email], fail_silently=False, ) messages.success(request, ' , ') return redirect('home') else: messages.error(request, ' ') else: form = ClientRegisterForm() return render(request, 'register.html', {'form': form, 'genres': Genre.objects.all(), 'authors': Author.objects.all()}) def register_complete(request): try: email = request.GET['login'] code = request.GET['code'].replace(' ', '+') if get_code(email, 'abs', 20) == code: # Delete outdated clients User.objects.filter(date_joined__lt=timezone.localtime() - time_for_registration, is_active=False, is_staff=False, is_superuser=False).delete() try: if User.objects.get(email=email).is_active is True: messages.warning(request, ' ') else: messages.success(request, ' , ') User.objects.filter(email=email).update(is_active=True) return redirect('authorize') except User.DoesNotExist: messages.error(request, ' ') else: messages.error(request, f' code ') except MultiValueDictKeyError as e: messages.error(request, f' {e.args}') return redirect('home') def authorize(request): if request.method == 'POST': form = ClientAuthorizationForm(data=request.POST) if form.is_valid(): client = form.get_user() login(request, client) messages.success(request, f' , {client.last_name} {client.first_name}') return redirect('home') else: messages.error(request, ' ') else: form = ClientAuthorizationForm() return render(request, 'authorize.html', {'form': form, 'genres': Genre.objects.all(), 'authors': Author.objects.all()}) def client_logout(request): logout(request) return redirect('home') def useful_information(request): return render(request, 'useful_information.html') def about_us(request): return render(request, 'about_us.html') def contact(request): return render(request, 'contact.html') def basket(request): if request.user.is_authenticated: if is_administrator(request.user): raise Http404('Administration does not have a basket') client = request.user.client_set.get() current_basket, is_created = client.baskets.get_or_create(status=Status.IN_PROCESS) if not should_show_price(request.user): current_basket.books.clear() if request.method == 'POST': if 'delete_book' in request.GET: current_basket.books.remove(request.GET['delete_book']) if 'clear' in request.GET: saved_basket = copy.copy(current_basket) saved_basket.status = Status.ABANDONED Basket.objects.filter(client=client, status=Status.ABANDONED).delete() saved_basket.save() client.baskets.add(saved_basket) current_basket.books.clear() # client.baskets.create(status=Status.ABANDONED, ) if 'restore' in request.GET: try: client.baskets.get(status=Status.ABANDONED) except Basket.DoesNotExist: raise Http404('Not found abandoned basket') client.baskets.filter(status=Status.IN_PROCESS).delete() client.baskets.filter(status=Status.ABANDONED).update(status=Status.IN_PROCESS) current_basket = client.baskets.get(status=Status.IN_PROCESS) return render(request, 'basket.html', {'BookModel': Book, 'books_in_basket': current_basket.books.all()}) else: raise Http404('User is not authenticated') def order(request): if request.user.is_authenticated and should_show_price(request.user): if is_administrator(request.user): raise Http404('Administration does not have a basket') client = request.user.client_set.get() current_basket, is_created = client.baskets.get_or_create(status=Status.IN_PROCESS) current_basket.status = Status.ON_HANDS current_basket.date_of_taking = timezone.now() current_basket.save() return render(request, 'order.html') else: raise Http404('User is not authenticated')
39.15859
232
0.664867
fdef583937c7416dc3c1150c9fa7843d7266de92
1,941
py
Python
extra/old-fix-midroll.py
FrederikBanke/critrolesync.github.io
ca09fff7541014d81472d687e48ecd5587cc15ff
[ "MIT" ]
5
2020-06-29T13:39:07.000Z
2022-02-07T00:43:55.000Z
extra/old-fix-midroll.py
FrederikBanke/critrolesync.github.io
ca09fff7541014d81472d687e48ecd5587cc15ff
[ "MIT" ]
11
2020-06-28T09:45:38.000Z
2022-03-30T17:56:35.000Z
extra/old-fix-midroll.py
FrederikBanke/critrolesync.github.io
ca09fff7541014d81472d687e48ecd5587cc15ff
[ "MIT" ]
5
2020-06-29T21:17:13.000Z
2021-09-08T06:34:32.000Z
def fixAnchorMidroll(newAdDuration=61, oldAdDuration=0): '''For fixing issue #8: https://github.com/critrolesync/critrolesync.github.io/issues/8''' anchor_podcast_episodes = data[1]['episodes'][19:] for ep in anchor_podcast_episodes: if 'timestampsBitrate' in ep: # need to adjust for new bitrate bitrateRatio = 128/127.7 else: # do need to adjust for bitrate bitrateRatio = 1 print(ep['id']) print() print(' "timestamps": [') for i, (youtube, podcast, comment) in enumerate(ep['timestamps']): if i<2: # before break podcast_new = sec2str(str2sec(podcast)*bitrateRatio) else: # after break podcast_new = sec2str((str2sec(podcast)-oldAdDuration+newAdDuration)*bitrateRatio) if i<len(ep['timestamps'])-1: # include final comma print(f' ["{youtube}", "{podcast_new}", "{comment}"],') else: # no final comma print(f' ["{youtube}", "{podcast_new}", "{comment}"]') print(' ]') print() print()
37.326923
98
0.548171
fdf00539d71fcfd43067729f990a71a6b54c1f86
415
py
Python
102-neopixel.d/main.py
wa1tnr/cpx-basic-studies
772d38803bc2394980d81cea7873a4bc027dfb9f
[ "MIT" ]
null
null
null
102-neopixel.d/main.py
wa1tnr/cpx-basic-studies
772d38803bc2394980d81cea7873a4bc027dfb9f
[ "MIT" ]
null
null
null
102-neopixel.d/main.py
wa1tnr/cpx-basic-studies
772d38803bc2394980d81cea7873a4bc027dfb9f
[ "MIT" ]
null
null
null
# Adafruit CircuitPython 2.2.0 # Adafruit CircuitPlayground Express import board ; import neopixel; import time pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.2) pixels.fill((0,0,0)) pixels.show() blue(); pixels.show(); time.sleep(0.7); magenta(); pixels.show(); time.sleep(1.4); pixels.fill((0,0,0)); pixels.show()
23.055556
61
0.684337
fdf08b92d38f1c12ce10c7842c25d8f96a214534
385
py
Python
indent/migrations/0003_indentmaster_note.py
yvsreenivas/inventory2
b92c03a398cb9831fa7a727a9a3287bdd9b17cd4
[ "MIT" ]
null
null
null
indent/migrations/0003_indentmaster_note.py
yvsreenivas/inventory2
b92c03a398cb9831fa7a727a9a3287bdd9b17cd4
[ "MIT" ]
null
null
null
indent/migrations/0003_indentmaster_note.py
yvsreenivas/inventory2
b92c03a398cb9831fa7a727a9a3287bdd9b17cd4
[ "MIT" ]
null
null
null
# Generated by Django 2.1.15 on 2021-03-15 15:04 from django.db import migrations, models
20.263158
48
0.597403