hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | 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 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | 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 2 1.02M | avg_line_length float64 1 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f74ab7f5b3a33b9a58b7e754ba039d38cbd5e017 | 27,325 | py | Python | reference_kernels/kernel.py | MarcusJones/kaggle_petfinder_adoption | 2d745b48405f4d4211b523eae272b9169fcf9fa2 | [
"MIT"
] | 1 | 2019-01-24T04:22:39.000Z | 2019-01-24T04:22:39.000Z | reference_kernels/kernel.py | MarcusJones/kaggle_petfinder_adoption | 2d745b48405f4d4211b523eae272b9169fcf9fa2 | [
"MIT"
] | null | null | null | reference_kernels/kernel.py | MarcusJones/kaggle_petfinder_adoption | 2d745b48405f4d4211b523eae272b9169fcf9fa2 | [
"MIT"
] | null | null | null | import gc
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import lightgbm as lgb
from collections import Counter
from functools import partial
from math import sqrt
from joblib import Parallel, delayed
from tqdm import tqdm
from PIL impo... | 40.967016 | 142 | 0.636377 | import gc
import glob
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy as sp
import lightgbm as lgb
from collections import Counter
from functools import partial
from math import sqrt
from joblib import Parallel, delayed
from tqdm import tqdm
from PIL impo... | true | true |
f74ab8863787d9773d1e9c4bb00f7c0201a6bb22 | 2,769 | py | Python | src/metpy/plots/cartopy_utils.py | gerritholl/MetPy | 3f08b770485835982989f34aedb87791af250301 | [
"BSD-3-Clause"
] | 819 | 2016-10-31T17:11:49.000Z | 2022-03-30T05:17:59.000Z | src/metpy/plots/cartopy_utils.py | gerritholl/MetPy | 3f08b770485835982989f34aedb87791af250301 | [
"BSD-3-Clause"
] | 1,557 | 2016-10-31T19:35:26.000Z | 2022-03-31T16:35:22.000Z | src/metpy/plots/cartopy_utils.py | gerritholl/MetPy | 3f08b770485835982989f34aedb87791af250301 | [
"BSD-3-Clause"
] | 336 | 2016-11-04T15:05:08.000Z | 2022-03-31T10:28:50.000Z | # Copyright (c) 2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Cartopy specific mapping utilities."""
try:
from cartopy.feature import Feature, Scaler
from ..cbook import get_test_data
class MetPyMapFeature(Feature):
... | 33.768293 | 91 | 0.616829 |
try:
from cartopy.feature import Feature, Scaler
from ..cbook import get_test_data
class MetPyMapFeature(Feature):
def __init__(self, name, scale, **kwargs):
import cartopy.crs as ccrs
super().__init__(ccrs.PlateCarree(), **kwargs)
self.name = name
... | true | true |
f74ab951eaec669f6888682deebeba3d936e2daf | 1,111 | py | Python | cvxpy/cvxcore/tests/python/364A_scripts/act_management.py | bstellato/cvxpy | c954bcfd14f9b131bd55d5c1028e667297a53f76 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cvxpy/cvxcore/tests/python/364A_scripts/act_management.py | bstellato/cvxpy | c954bcfd14f9b131bd55d5c1028e667297a53f76 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cvxpy/cvxcore/tests/python/364A_scripts/act_management.py | bstellato/cvxpy | c954bcfd14f9b131bd55d5c1028e667297a53f76 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | from cvxpy import Maximize, Problem, Variable, hstack, vstack
import numpy as np
import time
# Create two scalar optimization variables.
ANSWERS = []
TIME = 0
A = np.array([ [1, 2, 0, 1], \
[0, 0, 3, 1], \
[0, 3, 1, 1], \
[2, 1, 2, 5], \
[1, 0, 3, 2] ])
A_star = hstack(A,A)
c_max = np.array([100] * 5)
p = np.arr... | 20.2 | 105 | 0.616562 | from cvxpy import Maximize, Problem, Variable, hstack, vstack
import numpy as np
import time
ANSWERS = []
TIME = 0
A = np.array([ [1, 2, 0, 1], \
[0, 0, 3, 1], \
[0, 3, 1, 1], \
[2, 1, 2, 5], \
[1, 0, 3, 2] ])
A_star = hstack(A,A)
c_max = np.array([100] * 5)
p = np.array([3, 2, 7, 6])
p_disc = np.array([2, 1, 4... | true | true |
f74ab9f51fd980ae0e7f5111eb92b54d26839af9 | 3,339 | py | Python | SOACL_Web_Services/Flask_Web_Service/Flask_REST_server.py | SvenBaerten/soacl_project_musicplaylist_svenbaerten | d1892f1703eed82a997602d9dcf45bc59494fbe9 | [
"MIT"
] | null | null | null | SOACL_Web_Services/Flask_Web_Service/Flask_REST_server.py | SvenBaerten/soacl_project_musicplaylist_svenbaerten | d1892f1703eed82a997602d9dcf45bc59494fbe9 | [
"MIT"
] | null | null | null | SOACL_Web_Services/Flask_Web_Service/Flask_REST_server.py | SvenBaerten/soacl_project_musicplaylist_svenbaerten | d1892f1703eed82a997602d9dcf45bc59494fbe9 | [
"MIT"
] | null | null | null | # Reference to Flask: http://flask.pocoo.org/
from flask import Flask, current_app
from flask_restful import Api, Resource
import spotify.Spotify as Spotify
from flask_cors import CORS
# Reference to MySQL connector: https://dev.mysql.com/doc/connector-python/en/
import mysql.connector
from mysql.connector import erro... | 34.071429 | 208 | 0.619647 |
from flask import Flask, current_app
from flask_restful import Api, Resource
import spotify.Spotify as Spotify
from flask_cors import CORS
import mysql.connector
from mysql.connector import errorcode
class Start(Resource):
def get(self):
print('/')
return current_app.send_static_file('index.html... | true | true |
f74aba44c18293e49f85123b51bcb53fdb184d93 | 16,679 | py | Python | main.py | titania7777/3D-ResNets-PyTorch | 45921588bcf70f1b4ace424e754c48c0b5501ad6 | [
"MIT"
] | 3,481 | 2017-09-14T13:30:48.000Z | 2022-03-31T12:28:20.000Z | main.py | titania7777/3D-ResNets-PyTorch | 45921588bcf70f1b4ace424e754c48c0b5501ad6 | [
"MIT"
] | 253 | 2017-09-24T07:20:28.000Z | 2022-03-27T07:24:24.000Z | main.py | titania7777/3D-ResNets-PyTorch | 45921588bcf70f1b4ace424e754c48c0b5501ad6 | [
"MIT"
] | 969 | 2017-09-24T23:56:41.000Z | 2022-03-28T01:07:25.000Z | from pathlib import Path
import json
import random
import os
import numpy as np
import torch
from torch.nn import CrossEntropyLoss
from torch.optim import SGD, lr_scheduler
import torch.multiprocessing as mp
import torch.distributed as dist
from torch.backends import cudnn
import torchvision
from opts import parse_op... | 38.969626 | 86 | 0.623299 | from pathlib import Path
import json
import random
import os
import numpy as np
import torch
from torch.nn import CrossEntropyLoss
from torch.optim import SGD, lr_scheduler
import torch.multiprocessing as mp
import torch.distributed as dist
from torch.backends import cudnn
import torchvision
from opts import parse_op... | true | true |
f74aba467279013e2609f0ea936b92f3d79d1341 | 6,699 | py | Python | data/voc0712.py | IntoxicatedDING/stdn | 1bb9555114c762b09ad65eb16c59b134e1dccb56 | [
"MIT"
] | null | null | null | data/voc0712.py | IntoxicatedDING/stdn | 1bb9555114c762b09ad65eb16c59b134e1dccb56 | [
"MIT"
] | null | null | null | data/voc0712.py | IntoxicatedDING/stdn | 1bb9555114c762b09ad65eb16c59b134e1dccb56 | [
"MIT"
] | null | null | null | """VOC Dataset Classes
Original author: Francisco Massa
https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py
Updated by: Ellis Brown, Max deGroot
"""
'''
Adapted from https://github.com/amdegroot/ssd.pytorch
'''
from .config import HOME
import os.path as osp
import sys
import torch
import tor... | 35.444444 | 85 | 0.596805 | from .config import HOME
import os.path as osp
import sys
import torch
import torch.utils.data as data
import cv2
import numpy as np
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
VOC_CLASSES = (
'aeroplane', 'bicycle', 'bird', 'boat',
'bottl... | true | true |
f74aba5b301d4b7f183b255e98f254ffb4a1a2c8 | 4,057 | py | Python | viref/model.py | hazananayurt/viref | f7b5a2278d9211104ea2293077e2b85d7466d63a | [
"CC-BY-4.0",
"MIT"
] | 9 | 2019-08-07T13:06:19.000Z | 2021-12-18T11:46:15.000Z | viref/model.py | hazananayurt/viref | f7b5a2278d9211104ea2293077e2b85d7466d63a | [
"CC-BY-4.0",
"MIT"
] | null | null | null | viref/model.py | hazananayurt/viref | f7b5a2278d9211104ea2293077e2b85d7466d63a | [
"CC-BY-4.0",
"MIT"
] | 2 | 2019-08-28T18:39:32.000Z | 2020-07-15T11:25:52.000Z | import torch
from torch import optim
from torch.nn import Parameter
import torch.nn.functional as F
class Encoder(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_layers, dropout):
super(Encoder, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_layers =... | 31.207692 | 129 | 0.708898 | import torch
from torch import optim
from torch.nn import Parameter
import torch.nn.functional as F
class Encoder(torch.nn.Module):
def __init__(self, input_size, hidden_size, num_layers, dropout):
super(Encoder, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.num_layers =... | true | true |
f74abaa82e12ebac8832b5d10e5d0bd6949f10d5 | 1,531 | py | Python | waterflow/ml.py | ademilly/dataflow | 1cffbaf262a023c8db50966e5efae727d52f55d3 | [
"MIT"
] | 3 | 2016-09-06T23:53:56.000Z | 2016-09-11T22:03:15.000Z | waterflow/ml.py | ademilly/dataflow | 1cffbaf262a023c8db50966e5efae727d52f55d3 | [
"MIT"
] | 1 | 2016-09-06T15:06:44.000Z | 2016-09-06T15:06:44.000Z | waterflow/ml.py | ademilly/waterflow | 1cffbaf262a023c8db50966e5efae727d52f55d3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
class ML(dict):
def __init__(self, classifier=None, name=''):
"""Init ML object
Keyword arguments:
classifier (object) -- sklearn-like classifier
"""
self.clf = classifier
self.meta = {
'name': name
}
def fit(self... | 23.19697 | 77 | 0.512737 |
class ML(dict):
def __init__(self, classifier=None, name=''):
self.clf = classifier
self.meta = {
'name': name
}
def fit(self, X, y):
self.clf.fit(X, y)
return self
def predict_proba(self, X):
self.meta['probabilities'] = self.clf.predict_... | true | true |
f74abb25a810c9d08c01a520805141da477994a9 | 2,469 | py | Python | base/templatetags/custom_tags.py | amin-da71/Benbb96 | 0c9e37425d0665e403ba6fecf0c4b17669c29ada | [
"MIT"
] | null | null | null | base/templatetags/custom_tags.py | amin-da71/Benbb96 | 0c9e37425d0665e403ba6fecf0c4b17669c29ada | [
"MIT"
] | 13 | 2021-02-13T20:15:18.000Z | 2022-03-11T23:57:07.000Z | base/templatetags/custom_tags.py | amin-da71/Benbb96 | 0c9e37425d0665e403ba6fecf0c4b17669c29ada | [
"MIT"
] | null | null | null | from urllib.parse import quote_plus
from django import template
register = template.Library()
@register.filter
def multiply_10(value):
return int(float(value) * 10)
@register.filter
def color(value):
if value >= 8:
return 'success'
if value >= 6:
return 'info'
if value >= 4:
... | 26.836957 | 117 | 0.633455 | from urllib.parse import quote_plus
from django import template
register = template.Library()
@register.filter
def multiply_10(value):
return int(float(value) * 10)
@register.filter
def color(value):
if value >= 8:
return 'success'
if value >= 6:
return 'info'
if value >= 4:
... | true | true |
f74abb9689339b1e6b719f65908581352351a74d | 115 | py | Python | __init__.py | marat-/python-reporting-services | dd346fae578e97bf16ed66a14739edc17af56b1d | [
"Apache-2.0"
] | 2 | 2017-03-14T18:27:18.000Z | 2017-03-14T18:28:27.000Z | __init__.py | marat-/python-reporting-services | dd346fae578e97bf16ed66a14739edc17af56b1d | [
"Apache-2.0"
] | null | null | null | __init__.py | marat-/python-reporting-services | dd346fae578e97bf16ed66a14739edc17af56b1d | [
"Apache-2.0"
] | 3 | 2016-06-08T17:32:29.000Z | 2018-09-24T12:41:04.000Z | from pyssrs import SSRSReport
from parse_xlsx_xml import ParseXlsx
from xlsx_rc_convertor import convert_rc_formula | 38.333333 | 48 | 0.904348 | from pyssrs import SSRSReport
from parse_xlsx_xml import ParseXlsx
from xlsx_rc_convertor import convert_rc_formula | true | true |
f74abbba79eb52fecc6eafe2c0489bbb9206f98e | 263 | py | Python | testapp/config/desktop.py | emmuchira/kps | 4a81599a1ac17baea68e507794b246f45bf539b4 | [
"MIT"
] | null | null | null | testapp/config/desktop.py | emmuchira/kps | 4a81599a1ac17baea68e507794b246f45bf539b4 | [
"MIT"
] | null | null | null | testapp/config/desktop.py | emmuchira/kps | 4a81599a1ac17baea68e507794b246f45bf539b4 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Testapp",
"color": "grey",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("Testapp")
}
]
| 17.533333 | 44 | 0.612167 |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "Testapp",
"color": "grey",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("Testapp")
}
]
| true | true |
f74abbf2bea4cbd870bc08fd97a6072b7197bb1d | 784 | py | Python | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython | 1dcfdb6556e41c6dedcba2857aa4382b2f81aa59 | [
"MIT"
] | null | null | null | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython | 1dcfdb6556e41c6dedcba2857aa4382b2f81aa59 | [
"MIT"
] | null | null | null | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython | 1dcfdb6556e41c6dedcba2857aa4382b2f81aa59 | [
"MIT"
] | null | null | null | def leia_int(n):
while True:
try:
nu = int(input(n))
except(ValueError, TypeError):
print('\033[31mERRO: por favor, digite um número inteiro válido.\033[m')
continue
else:
return nu
def leia_float(n):
while True:
try:
nu... | 28 | 84 | 0.524235 | def leia_int(n):
while True:
try:
nu = int(input(n))
except(ValueError, TypeError):
print('\033[31mERRO: por favor, digite um número inteiro válido.\033[m')
continue
else:
return nu
def leia_float(n):
while True:
try:
nu... | true | true |
f74abc94486ddddc08c1e28c21db35c8c45d8d63 | 2,450 | py | Python | QUANTAXIS/QAUtil/QALogs.py | KouLemon/QUANTAXIS_BET | 7b1d6c0c3bed03cfac7724807d70da0e38e43fee | [
"MIT"
] | 1 | 2021-05-20T12:33:46.000Z | 2021-05-20T12:33:46.000Z | QUANTAXIS/QAUtil/QALogs.py | KouLemon/QUANTAXIS_BET | 7b1d6c0c3bed03cfac7724807d70da0e38e43fee | [
"MIT"
] | 2 | 2017-12-27T02:34:32.000Z | 2018-04-18T02:50:13.000Z | QUANTAXIS/QAUtil/QALogs.py | KouLemon/QUANTAXIS_BET | 7b1d6c0c3bed03cfac7724807d70da0e38e43fee | [
"MIT"
] | 1 | 2021-04-01T08:59:46.000Z | 2021-04-01T08:59:46.000Z | # Coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | 29.166667 | 80 | 0.7 |
import datetime
from zenlog import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s QUANTAXIS>>> %(message)s',
datefmt='%H:%M:%S',
filename='quantaxis-' +
str(datetime.datetime.now().strftime(
... | true | true |
f74abddfe5c74cf5f0f98783b2cb3c79c9162c1e | 14,621 | py | Python | roles/validate-tempest/files/tempestmail/tempestmail.py | dp450/tripleo-quickstart-extras | c9151588399a8dd2ed10be301502cf05481d0ef5 | [
"Apache-2.0"
] | 3 | 2018-09-05T08:34:05.000Z | 2019-09-26T19:01:11.000Z | roles/validate-tempest/files/tempestmail/tempestmail.py | dp450/tripleo-quickstart-extras | c9151588399a8dd2ed10be301502cf05481d0ef5 | [
"Apache-2.0"
] | 15 | 2018-10-10T17:53:42.000Z | 2021-03-31T07:55:08.000Z | roles/validate-tempest/files/tempestmail/tempestmail.py | dp450/tripleo-quickstart-extras | c9151588399a8dd2ed10be301502cf05481d0ef5 | [
"Apache-2.0"
] | 4 | 2019-01-03T21:34:34.000Z | 2019-10-04T15:20:49.000Z | #! /usr/bin/env python
# Copyright Red Hat, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | 35.574209 | 79 | 0.54196 |
import argparse
import datetime
import logging
import os
import re
import requests
import smtplib
import sys
import yaml
from email.mime.text import MIMEText
from jinja2 import Environment
from jinja2 import FileSystemLoader
from six.moves.urllib.parse import urljoin
HREF = re.compile('href="([^"]+)"'... | true | true |
f74abe6b53ee378cbc4310b883c3044ae96c5640 | 5,797 | py | Python | tests/changes/api/test_build_flaky_tests.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 443 | 2015-01-03T16:28:39.000Z | 2021-04-26T16:39:46.000Z | tests/changes/api/test_build_flaky_tests.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 12 | 2015-07-30T19:07:16.000Z | 2016-11-07T23:11:21.000Z | tests/changes/api/test_build_flaky_tests.py | vault-the/changes | 37e23c3141b75e4785cf398d015e3dbca41bdd56 | [
"Apache-2.0"
] | 47 | 2015-01-09T10:04:00.000Z | 2020-11-18T17:58:19.000Z | from uuid import uuid4
from changes.constants import Result, Status
from changes.testutils import APITestCase, SAMPLE_DIFF
class BuildFlakyTests(APITestCase):
def setUp(self):
super(BuildFlakyTests, self).setUp()
self.project = self.create_project()
self.create_plan(self.project)
... | 34.505952 | 126 | 0.59203 | from uuid import uuid4
from changes.constants import Result, Status
from changes.testutils import APITestCase, SAMPLE_DIFF
class BuildFlakyTests(APITestCase):
def setUp(self):
super(BuildFlakyTests, self).setUp()
self.project = self.create_project()
self.create_plan(self.project)
... | true | true |
f74abea69e2afe7617605ec41c3b898e125a6889 | 3,250 | py | Python | dikedata_api/testsettings.py | ddsc/dikedata-api | 74776575a848863975793a9fde106161c655ee44 | [
"MIT"
] | null | null | null | dikedata_api/testsettings.py | ddsc/dikedata-api | 74776575a848863975793a9fde106161c655ee44 | [
"MIT"
] | null | null | null | dikedata_api/testsettings.py | ddsc/dikedata-api | 74776575a848863975793a9fde106161c655ee44 | [
"MIT"
] | null | null | null | import os
from lizard_ui.settingshelper import setup_logging
from lizard_ui.settingshelper import STATICFILES_FINDERS
DEBUG = True
TEMPLATE_DEBUG = True
# SETTINGS_DIR allows media paths and so to be relative to this settings file
# instead of hardcoded to c:\only\on\my\computer.
SETTINGS_DIR = os.path.dirname(os.pa... | 33.505155 | 79 | 0.704615 | import os
from lizard_ui.settingshelper import setup_logging
from lizard_ui.settingshelper import STATICFILES_FINDERS
DEBUG = True
TEMPLATE_DEBUG = True
SETTINGS_DIR = os.path.dirname(os.path.realpath(__file__))
BUILDOUT_DIR = os.path.abspath(os.path.join(SETTINGS_DIR, '..'))
LOGGING = setup_logging(BUILDOUT_D... | true | true |
f74abf403219def567ea69fc0e3534db02913fcf | 1,817 | py | Python | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/postgres_manager_wrap.py | jsuberza/earthenterprise | e661a41f7cc218c60b269b0c9911df928cd9ce12 | [
"Apache-2.0"
] | 1 | 2020-06-17T12:20:52.000Z | 2020-06-17T12:20:52.000Z | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/postgres_manager_wrap.py | jsuberza/earthenterprise | e661a41f7cc218c60b269b0c9911df928cd9ce12 | [
"Apache-2.0"
] | null | null | null | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/postgres_manager_wrap.py | jsuberza/earthenterprise | e661a41f7cc218c60b269b0c9911df928cd9ce12 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
#
# Copyright 2017 Google Inc.
# Copyright 2018 Open GEE Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | 29.306452 | 74 | 0.720969 |
import logging
import os
import sys
sys.path.insert(1, os.path.join(
os.path.dirname(os.path.realpath(__file__)), "../../wsgi-bin/common"))
import postgres_manager
import postgres_properties
class PostgresManagerWrap(object):
DB_PORT = postgres_properties.PostgresProperties().GetPortNumber()... | true | true |
f74ac0fe24ca0bcfe33198c3b87efbc52d66a3f0 | 2,682 | py | Python | molecule/verifier/ansible.py | westurner/molecule | 1babb77a8785192be38ab122e8206a0e53777b83 | [
"MIT"
] | null | null | null | molecule/verifier/ansible.py | westurner/molecule | 1babb77a8785192be38ab122e8206a0e53777b83 | [
"MIT"
] | null | null | null | molecule/verifier/ansible.py | westurner/molecule | 1babb77a8785192be38ab122e8206a0e53777b83 | [
"MIT"
] | null | null | null | # Copyright (c) 2019 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, ... | 27.9375 | 79 | 0.650261 |
import os
from molecule import logger
from molecule import util
from molecule.api import Verifier
log = logger.get_logger(__name__)
class Ansible(Verifier):
@property
def name(self):
return 'ansible'
@property
def default_options(self):
return {}
@property... | true | true |
f74ac1c1ddc30adef91577c5d4b73557f21736f3 | 605 | py | Python | schreib_project/posts/serializers.py | krishishah/Schreib | 345754c63de17f4d7d06bd339f6def3e52fe71fe | [
"MIT"
] | null | null | null | schreib_project/posts/serializers.py | krishishah/Schreib | 345754c63de17f4d7d06bd339f6def3e52fe71fe | [
"MIT"
] | null | null | null | schreib_project/posts/serializers.py | krishishah/Schreib | 345754c63de17f4d7d06bd339f6def3e52fe71fe | [
"MIT"
] | null | null | null | from rest_framework import serializers
from authentication.serializers import AccountSerializer
from posts.models import Post
class PostSerializer(serializers.ModelSerializer):
author = AccountSerializer(read_only=True, required=False)
class Meta:
model = Post
fields = ('id', 'author', 'con... | 30.25 | 90 | 0.715702 | from rest_framework import serializers
from authentication.serializers import AccountSerializer
from posts.models import Post
class PostSerializer(serializers.ModelSerializer):
author = AccountSerializer(read_only=True, required=False)
class Meta:
model = Post
fields = ('id', 'author', 'con... | true | true |
f74ac1f1008b652c862cdde63299fa0dfc8d87ae | 4,872 | py | Python | tests/test_wlans.py | JohnLahr/aiounifi | e9313a72e7db2f486f6c12634c77fcc2e3ebc138 | [
"MIT"
] | null | null | null | tests/test_wlans.py | JohnLahr/aiounifi | e9313a72e7db2f486f6c12634c77fcc2e3ebc138 | [
"MIT"
] | null | null | null | tests/test_wlans.py | JohnLahr/aiounifi | e9313a72e7db2f486f6c12634c77fcc2e3ebc138 | [
"MIT"
] | null | null | null | """Test wlan configuration API.
pytest --cov-report term-missing --cov=aiounifi.wlan tests/test_wlans.py
"""
from asynctest import Mock
from aiounifi.wlan import Wlans
def test_ports():
"""Test that different types of ports work."""
wlans = Wlans(fixture_wlans, Mock())
assert len(wlans.values()) == 2
... | 34.8 | 72 | 0.649425 |
from asynctest import Mock
from aiounifi.wlan import Wlans
def test_ports():
wlans = Wlans(fixture_wlans, Mock())
assert len(wlans.values()) == 2
key = "SSID 1"
assert wlans[key].id == "012345678910111213141516"
assert wlans[key].bc_filter_enabled == False
assert wlans[key].bc_filter_list ... | true | true |
f74ac326535efc9aeac20c0df42a1b4963432229 | 7,456 | py | Python | test_gilded_rose.py | nathfroech/gilded_rose_refactoring_kata | 305d02ddc87bef172f7c7058f9c0a7b8812f2f50 | [
"MIT"
] | null | null | null | test_gilded_rose.py | nathfroech/gilded_rose_refactoring_kata | 305d02ddc87bef172f7c7058f9c0a7b8812f2f50 | [
"MIT"
] | null | null | null | test_gilded_rose.py | nathfroech/gilded_rose_refactoring_kata | 305d02ddc87bef172f7c7058f9c0a7b8812f2f50 | [
"MIT"
] | null | null | null | import pytest
from hamcrest import assert_that, contains_exactly, equal_to, has_properties, is_ # type: ignore
import gilded_rose
class TestGildedRose:
def test_combined_case(self):
items = [
gilded_rose.Item(name='+5 Dexterity Vest', sell_in=10, quality=20),
gilded_rose.Item(nam... | 48.732026 | 115 | 0.698095 | import pytest
from hamcrest import assert_that, contains_exactly, equal_to, has_properties, is_
import gilded_rose
class TestGildedRose:
def test_combined_case(self):
items = [
gilded_rose.Item(name='+5 Dexterity Vest', sell_in=10, quality=20),
gilded_rose.Item(name=gilded_rose.... | true | true |
f74ac3c2e3d9d2e9c146f725db8f41c033811ee2 | 1,495 | py | Python | yasir/rt.py | overminder/YASIR | 106140329fd415cab591eb642827021759abd426 | [
"MIT"
] | 1 | 2019-11-21T17:07:49.000Z | 2019-11-21T17:07:49.000Z | yasir/rt.py | overminder/YASIR | 106140329fd415cab591eb642827021759abd426 | [
"MIT"
] | null | null | null | yasir/rt.py | overminder/YASIR | 106140329fd415cab591eb642827021759abd426 | [
"MIT"
] | null | null | null | from rpython.rlib import jit
from . import pretty
class ImmutableEnv(object):
_immutable_fields_ = ['_w_slots[*]', '_prev']
def __init__(self, w_values, prev):
self._w_slots = w_values
self._prev = prev
@jit.unroll_safe
def at_depth(self, depth):
#depth = jit.promote(depth)
... | 22.313433 | 61 | 0.602676 | from rpython.rlib import jit
from . import pretty
class ImmutableEnv(object):
_immutable_fields_ = ['_w_slots[*]', '_prev']
def __init__(self, w_values, prev):
self._w_slots = w_values
self._prev = prev
@jit.unroll_safe
def at_depth(self, depth):
i = depth
it... | true | true |
f74ac46cd630eedc9d320781bf48a98f1f947bf6 | 37,179 | py | Python | network/model_zoo.py | XiaoJake/DS-Net | 8400da1bd7c7b1ccf4d5c6782b86372957e79a6b | [
"MIT"
] | null | null | null | network/model_zoo.py | XiaoJake/DS-Net | 8400da1bd7c7b1ccf4d5c6782b86372957e79a6b | [
"MIT"
] | null | null | null | network/model_zoo.py | XiaoJake/DS-Net | 8400da1bd7c7b1ccf4d5c6782b86372957e79a6b | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
# author: Hong Fangzhou
# @file: model_zoo.py
# @time: 2020/09/26 17:05
from .modules import BEV_Unet
from .modules import PointNet
from .modules import spconv_unet
from .modules import pytorch_meanshift
from .loss import instance_losses
from .loss import lovasz_losses
from utils.evaluate_panopt... | 47.849421 | 174 | 0.640873 |
from .modules import BEV_Unet
from .modules import PointNet
from .modules import spconv_unet
from .modules import pytorch_meanshift
from .loss import instance_losses
from .loss import lovasz_losses
from utils.evaluate_panoptic import init_eval, eval_one_scan_w_fname, eval_one_scan_vps
from utils.evaluate_panoptic ... | true | true |
f74ac5366b7c17a8874cdd778651bc792348ae83 | 226,611 | py | Python | core/domain/exp_services_test.py | soham4abc/oppia | 3b9a71c2142dc0f818fcab00afc749fa0695ad82 | [
"Apache-2.0"
] | null | null | null | core/domain/exp_services_test.py | soham4abc/oppia | 3b9a71c2142dc0f818fcab00afc749fa0695ad82 | [
"Apache-2.0"
] | null | null | null | core/domain/exp_services_test.py | soham4abc/oppia | 3b9a71c2142dc0f818fcab00afc749fa0695ad82 | [
"Apache-2.0"
] | null | null | null | # coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 40.889751 | 137 | 0.611687 |
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import logging
import os
import re
import zipfile
from core.domain import classifier_services
from core.domain import draft_upgrade_services
from core.domain import exp_domain
from core.domain import ex... | true | true |
f74ac6fcc9b5678b5a9fa4e58ff6c0ec323ee1a3 | 861 | py | Python | email01.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | email01.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | email01.py | sgriffith3/2021_05_10_pyna | d732e1dd0fa03f1cef8f72fc9dcc09ec947f31a5 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
import smtplib # make the smtplib module avail
import getpass # secret acceptance of password
def send_my_message(subj, txt):
mypass = getpass.getpass("Enter your Password:")
myaddress = input("Enter your mail.com address (ex. pythonstudent01@mail.com):")
content = f"""From:{myaddre... | 35.875 | 84 | 0.702671 |
import smtplib
import getpass
def send_my_message(subj, txt):
mypass = getpass.getpass("Enter your Password:")
myaddress = input("Enter your mail.com address (ex. pythonstudent01@mail.com):")
content = f"""From:{myaddress}\n
Subject: {subj}\n\n{txt}"""
mail = smtplib.SMTP('smtp.mail.com',587)
... | true | true |
f74ac76b9746d67f335eb56389b3c1acb78b8edf | 13,246 | py | Python | CoreFiles/CaseBuilder_OAT.py | KTH-UrbanT/MUBES_UBEM | 04fee34097a8b8724fac2f5d0d3495230b6af0c1 | [
"MIT"
] | 8 | 2021-09-20T16:14:53.000Z | 2022-01-13T13:36:50.000Z | CoreFiles/CaseBuilder_OAT.py | KTH-UrbanT/MUBES_UBEM | 04fee34097a8b8724fac2f5d0d3495230b6af0c1 | [
"MIT"
] | null | null | null | CoreFiles/CaseBuilder_OAT.py | KTH-UrbanT/MUBES_UBEM | 04fee34097a8b8724fac2f5d0d3495230b6af0c1 | [
"MIT"
] | 1 | 2021-09-20T16:14:56.000Z | 2021-09-20T16:14:56.000Z | # @Author : Xavier Faure
# @Email : xavierf@kth.se
import os
import sys
#add the required path
path2addgeom = os.path.join(os.path.dirname(os.path.dirname(os.getcwd())),'geomeppy')
sys.path.append(path2addgeom)
#add scripts from the project as well
sys.path.append("..")
from subprocess import check_call
from geomep... | 45.993056 | 141 | 0.614903 |
import os
import sys
path2addgeom = os.path.join(os.path.dirname(os.path.dirname(os.getcwd())),'geomeppy')
sys.path.append(path2addgeom)
sys.path.append("..")
from subprocess import check_call
from geomeppy import IDF
import pickle
import pickle5
import CoreFiles.GeneralFunctions as GrlFct
from BuildObject.DB_Buil... | true | true |
f74ac795ee280f0f8bd4711730e8966de9b33f62 | 1,840 | py | Python | main/api/v1/repo.py | AlexRogalskiy/github-stats | 49dbf8841e71a532e504865d5c1226ab158e7f8c | [
"MIT"
] | 99 | 2015-12-21T17:14:44.000Z | 2022-03-18T23:20:45.000Z | main/api/v1/repo.py | lipis/github-graph | 49dbf8841e71a532e504865d5c1226ab158e7f8c | [
"MIT"
] | 7 | 2015-12-26T18:52:16.000Z | 2019-03-13T11:01:32.000Z | main/api/v1/repo.py | AlexRogalskiy/github-stats | 49dbf8841e71a532e504865d5c1226ab158e7f8c | [
"MIT"
] | 16 | 2016-03-12T09:50:55.000Z | 2022-03-18T23:20:45.000Z | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
import flask_restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
@api_v1.resource('/repo/', endpoint='api.repo.list')
class RepoListAPI(flask_restful.Resource):
def g... | 31.724138 | 79 | 0.680435 |
from __future__ import absolute_import
from google.appengine.ext import ndb
import flask_restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
@api_v1.resource('/repo/', endpoint='api.repo.list')
class RepoListAPI(flask_restful.Resource):
def get(self):
r... | true | true |
f74ac7e5c277f81d44f41463e67899ec318ab72d | 7,128 | py | Python | applications/nightly_build/test_deep_speech.py | vinitra/keras-onnx | 17d86705f566bee56307abd13a60b79776a58c0e | [
"MIT"
] | 1 | 2020-10-26T03:03:02.000Z | 2020-10-26T03:03:02.000Z | applications/nightly_build/test_deep_speech.py | vinitra/keras-onnx | 17d86705f566bee56307abd13a60b79776a58c0e | [
"MIT"
] | null | null | null | applications/nightly_build/test_deep_speech.py | vinitra/keras-onnx | 17d86705f566bee56307abd13a60b79776a58c0e | [
"MIT"
] | null | null | null | ###############################################################################
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
###############################################################################
imp... | 41.684211 | 106 | 0.602413 | true | true | |
f74ac855293d6aaa581aed3ef3cd6aabd694a380 | 1,517 | py | Python | floodsystem/flood.py | HSCam/Flood-Warning-Sytem | 1f88dcee38854b327db417835190e55b39de6eb6 | [
"MIT"
] | null | null | null | floodsystem/flood.py | HSCam/Flood-Warning-Sytem | 1f88dcee38854b327db417835190e55b39de6eb6 | [
"MIT"
] | null | null | null | floodsystem/flood.py | HSCam/Flood-Warning-Sytem | 1f88dcee38854b327db417835190e55b39de6eb6 | [
"MIT"
] | 1 | 2022-02-08T13:39:54.000Z | 2022-02-08T13:39:54.000Z | #Contains all the functions required for assessing flood risk
#Exercise 2B - assessing flood risk by level:
def stations_level_over_threshold(stations, tol):
"""returns a list of tuples of stations with relative water level over tol."""
stations_over_threshold = []
for station in stations:
try: ... | 43.342857 | 184 | 0.695452 |
def stations_level_over_threshold(stations, tol):
stations_over_threshold = []
for station in stations:
try:
if station.relative_water_level()>tol:
stations_over_threshold.append((station.name, station.relative_water_level()))
if type(station.relative_... | true | true |
f74ac8aba771b55c79e3f508c23484786eea91c3 | 1,471 | py | Python | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni | f652e230524346bf0801cdf8bbb6ee63f4985cc2 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni | f652e230524346bf0801cdf8bbb6ee63f4985cc2 | [
"BSD-2-Clause-FreeBSD"
] | 2 | 2019-07-24T12:41:11.000Z | 2020-03-31T10:10:04.000Z | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni | f652e230524346bf0801cdf8bbb6ee63f4985cc2 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2019-02-25T14:58:20.000Z | 2019-02-25T14:58:20.000Z | # -*- coding: utf-8 -*-
__author__ = 'ffuentes'
import argparse
import os
import sys
import csv
import logging
from apps.noclook.models import ServiceType, ServiceClass
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('noclook_service_types_import')
def insert_service_ty... | 30.645833 | 72 | 0.611149 |
__author__ = 'ffuentes'
import argparse
import os
import sys
import csv
import logging
from apps.noclook.models import ServiceType, ServiceClass
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('noclook_service_types_import')
def insert_service_type(name, service_class)... | true | true |
f74ac99c2015a184ef1abd6be3207fce3e7eedae | 5,636 | py | Python | main/maintenance/borrower/routes.py | python-02/flask-spa-CoopApp | 8ecd9e22847401c6ee18b76a80c68c8ba5d77401 | [
"MIT"
] | 6 | 2021-04-16T06:37:04.000Z | 2021-11-11T23:37:04.000Z | main/maintenance/borrower/routes.py | python-02/flask-spa-CoopApp | 8ecd9e22847401c6ee18b76a80c68c8ba5d77401 | [
"MIT"
] | null | null | null | main/maintenance/borrower/routes.py | python-02/flask-spa-CoopApp | 8ecd9e22847401c6ee18b76a80c68c8ba5d77401 | [
"MIT"
] | 2 | 2021-06-01T15:35:17.000Z | 2022-03-05T03:50:57.000Z | from flask import Blueprint, render_template, g, request, flash
import flask_sijax
from main.models.borrower import Borrower
from flask_login import LoginManager, login_user, login_required, logout_user, current_user
from main.maintenance.borrower.forms import BorrowerMaintenanceForm
from main.spa_handler.sijax_handler... | 43.689922 | 224 | 0.680625 | from flask import Blueprint, render_template, g, request, flash
import flask_sijax
from main.models.borrower import Borrower
from flask_login import LoginManager, login_user, login_required, logout_user, current_user
from main.maintenance.borrower.forms import BorrowerMaintenanceForm
from main.spa_handler.sijax_handler... | true | true |
f74acc1e92d1acefc7477fb9eac4f86b79b58d02 | 61,600 | py | Python | Boilermake2018/Lib/site-packages/nltk/parse/chart.py | TejPatel98/voice_your_professional_email | 9cc48f7bcd6576a6962711755e5d5d485832128c | [
"CC0-1.0"
] | 69 | 2020-03-31T06:40:17.000Z | 2022-02-25T11:48:18.000Z | Boilermake2018/Lib/site-packages/nltk/parse/chart.py | TejPatel98/voice_your_professional_email | 9cc48f7bcd6576a6962711755e5d5d485832128c | [
"CC0-1.0"
] | 11 | 2019-12-26T17:21:03.000Z | 2022-03-21T22:17:07.000Z | Boilermake2018/Lib/site-packages/nltk/parse/chart.py | TejPatel98/voice_your_professional_email | 9cc48f7bcd6576a6962711755e5d5d485832128c | [
"CC0-1.0"
] | 28 | 2020-04-15T15:24:17.000Z | 2021-12-26T04:05:02.000Z | # -*- coding: utf-8 -*-
# Natural Language Toolkit: A Chart Parser
#
# Copyright (C) 2001-2018 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Jean Mark Gawron <gawron@mail.sdsu.edu>
# Peter Ljunglöf <peter.ljunglof@heatherleaf.se>
# URL: <http://n... | 36.601307 | 90 | 0.568149 |
from __future__ import print_function, division, unicode_literals
import itertools
import re
import warnings
from functools import total_ordering
from six.moves import range
from nltk.tree import Tree
from nltk.grammar import PCFG, is_nonterminal, is_terminal
from nltk.util import OrderedDict
from nltk.in... | true | true |
f74acd8aa192c83afc388b2a920ee86cdf5f5300 | 2,904 | py | Python | impacket/examples/ntlmrelayx/utils/enum.py | fox-it/impacket | 0b6e23f5edf18d89e513287790f602e356d92235 | [
"Apache-1.1"
] | 10 | 2017-12-11T01:50:59.000Z | 2021-12-30T13:44:37.000Z | impacket/examples/ntlmrelayx/utils/enum.py | fox-it/impacket | 0b6e23f5edf18d89e513287790f602e356d92235 | [
"Apache-1.1"
] | null | null | null | impacket/examples/ntlmrelayx/utils/enum.py | fox-it/impacket | 0b6e23f5edf18d89e513287790f602e356d92235 | [
"Apache-1.1"
] | 2 | 2018-02-27T08:46:19.000Z | 2020-04-14T19:31:27.000Z | # Copyright (c) 2013-2016 CORE Security Technologies
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Config utilities
#
# Author:
# Ronnie Flathers / @ropnop
#
# Description:
# Helpful ... | 40.901408 | 123 | 0.675275 |
from impacket.dcerpc.v5 import transport, lsat, lsad, samr
from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWED
from impacket.dcerpc.v5.rpcrt import DCERPCException
from impacket.dcerpc.v5.samr import SID_NAME_USE
class EnumLocalAdmins:
def __init__(self, smbConnection):
self.__smb... | true | true |
f74acdbb4597d166304e1d190cd6c005427346ce | 439 | py | Python | spyplugins/ui/__init__.py | SylvainCorlay/spyder | b87bfa08abd53e1c97b59feeb51f665f6a632415 | [
"MIT"
] | 2 | 2016-01-23T11:52:24.000Z | 2021-04-27T03:52:25.000Z | spyplugins/ui/__init__.py | SylvainCorlay/spyder | b87bfa08abd53e1c97b59feeb51f665f6a632415 | [
"MIT"
] | null | null | null | spyplugins/ui/__init__.py | SylvainCorlay/spyder | b87bfa08abd53e1c97b59feeb51f665f6a632415 | [
"MIT"
] | null | null | null | """
'spyplugins' makes uses of namespace packages to keep different plugins
organized in the sitepackages directory and in the user directory.
Spyder plugins can be of 'io' type or 'ui' type. Each type also makes use
of namespace packages.
For more information on namespace packages visit:
- https://www.python.org/dev... | 36.583333 | 73 | 0.776765 | __import__('pkg_resources').declare_namespace(__name__) | true | true |
f74ace4d8c52f5f7c999fa7ea6ee0cc95c2f1689 | 1,010 | py | Python | userbot/plugins/alive.py | SPIDERBHAI/HunterGang | 6c71a7aee52b01fb2b03c3a9af0b0faa40a08cfe | [
"MIT"
] | null | null | null | userbot/plugins/alive.py | SPIDERBHAI/HunterGang | 6c71a7aee52b01fb2b03c3a9af0b0faa40a08cfe | [
"MIT"
] | null | null | null | userbot/plugins/alive.py | SPIDERBHAI/HunterGang | 6c71a7aee52b01fb2b03c3a9af0b0faa40a08cfe | [
"MIT"
] | 1 | 2020-08-05T16:59:42.000Z | 2020-08-05T16:59:42.000Z | """Check if userbot alive. If you change these, you become the gayest gay such that even the gay world will disown you."""
import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
ALI... | 50.5 | 122 | 0.639604 | import asyncio
from telethon import events
from telethon.tl.types import ChannelParticipantsAdmins
from platform import uname
from userbot import ALIVE_NAME
from userbot.utils import admin_cmd
ALIVE_NAME = str(ALIVE_NAME) if ALIVE_NAME else "**No Name set yet.**"
@command(outgoing=True, pattern="^.alive$")
async def ... | true | true |
f74ace61335909d5599194850ddd17617a19dcfb | 1,432 | py | Python | exe094.py | libaniaraujo/Python-Curso-em-Video | 593ddbbbdf1e83101f535228fa05351f35b8817f | [
"MIT"
] | null | null | null | exe094.py | libaniaraujo/Python-Curso-em-Video | 593ddbbbdf1e83101f535228fa05351f35b8817f | [
"MIT"
] | null | null | null | exe094.py | libaniaraujo/Python-Curso-em-Video | 593ddbbbdf1e83101f535228fa05351f35b8817f | [
"MIT"
] | null | null | null | # Unindo dicionários e listas
# Crie um programa que leia nome, sexo e idade de várias pessoas, guardando os dados de cada pessoa em um dicionário
# e todos os dicionários em uma lista. No final, mostre:
# A) Quantas pessoas foram cadastradas
# B) A média de idade
# C) Uma lista com as mulheres
# D) Uma lista de pesso... | 31.822222 | 116 | 0.592179 |
galera = list()
pessoa = dict()
soma = média = 0
while True:
pessoa.clear()
pessoa['nome'] = str(input('Nome: '))
while True:
pessoa['sexo'] = str(input('Sexo: [M/F] ')).upper()[0]
if pessoa['sexo'] in 'MF':
break
print('Erro! Por favor, digite apenas M ou F.')
... | true | true |
f74acede50729fe4f3f4926ff1465106a3c15b27 | 45,000 | py | Python | homeassistant/config_entries.py | szimszon/core | 1600207f5cd73ecd70bf965f1787a7f5aae6b81d | [
"Apache-2.0"
] | 1 | 2017-05-30T22:21:05.000Z | 2017-05-30T22:21:05.000Z | homeassistant/config_entries.py | szimszon/core | 1600207f5cd73ecd70bf965f1787a7f5aae6b81d | [
"Apache-2.0"
] | 51 | 2020-10-14T01:19:07.000Z | 2022-03-31T06:02:48.000Z | homeassistant/config_entries.py | foxy82/home-assistant | 79ebe930e31a91967928a5642c98e58b522109b0 | [
"Apache-2.0"
] | 1 | 2021-08-16T02:53:15.000Z | 2021-08-16T02:53:15.000Z | """Manage config entries in Home Assistant."""
from __future__ import annotations
import asyncio
import functools
import logging
from types import MappingProxyType, MethodType
from typing import Any, Callable, Dict, List, Optional, Set, Union, cast
import weakref
import attr
from homeassistant import data_entry_flow... | 35.15625 | 125 | 0.623267 | from __future__ import annotations
import asyncio
import functools
import logging
from types import MappingProxyType, MethodType
from typing import Any, Callable, Dict, List, Optional, Set, Union, cast
import weakref
import attr
from homeassistant import data_entry_flow, loader
from homeassistant.core import CALLBAC... | true | true |
f74acf46021754d988a452acdcc5f8e0908e656d | 663 | py | Python | py/t4/demo2.py | firekyrin/train-demo | a949a461bb9324fc2732cdf80c42c26379442c96 | [
"MIT"
] | null | null | null | py/t4/demo2.py | firekyrin/train-demo | a949a461bb9324fc2732cdf80c42c26379442c96 | [
"MIT"
] | null | null | null | py/t4/demo2.py | firekyrin/train-demo | a949a461bb9324fc2732cdf80c42c26379442c96 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import threading
mylock = threading.RLock()
num = 0
class WorkThread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.t_name = name
def run(self):
global num
while True:
mylock.acquire()
print('\n%s locked, number: %d' %(self.t_name, num))
if... | 18.942857 | 58 | 0.648567 |
import threading
mylock = threading.RLock()
num = 0
class WorkThread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.t_name = name
def run(self):
global num
while True:
mylock.acquire()
print('\n%s locked, number: %d' %(self.t_name, num))
if num >= 4:
mylock... | true | true |
f74ad232ec7a8e2fa67c04b6ea76c4ec10489f84 | 3,734 | py | Python | pycondor/tests/test_utils.py | GregoryAshton/pycondor | 72423eac508c6d5ec79f8f3de71011ba61a38537 | [
"MIT"
] | 23 | 2017-05-16T21:37:07.000Z | 2021-11-15T13:46:03.000Z | pycondor/tests/test_utils.py | GregoryAshton/pycondor | 72423eac508c6d5ec79f8f3de71011ba61a38537 | [
"MIT"
] | 83 | 2017-01-27T21:00:38.000Z | 2022-02-10T16:27:54.000Z | pycondor/tests/test_utils.py | GregoryAshton/pycondor | 72423eac508c6d5ec79f8f3de71011ba61a38537 | [
"MIT"
] | 14 | 2017-04-05T15:40:37.000Z | 2021-11-15T13:38:09.000Z |
import os
import pytest
import pycondor
from pycondor.utils import (clear_pycondor_environment_variables, checkdir,
assert_command_exists, get_condor_version,
parse_condor_version, split_command_string,
decode_string)
from pycondor.com... | 31.378151 | 83 | 0.670059 |
import os
import pytest
import pycondor
from pycondor.utils import (clear_pycondor_environment_variables, checkdir,
assert_command_exists, get_condor_version,
parse_condor_version, split_command_string,
decode_string)
from pycondor.com... | true | true |
f74ad23c4e370ad016ec7755ea76ab3fd4cfe2ce | 1,845 | py | Python | tools/harness-automation/cases/router_5_6_3.py | amccool/openthread | 1e9d3c1dbfd66aa48c4cbb1dda0b41c9f05fefc7 | [
"BSD-3-Clause"
] | null | null | null | tools/harness-automation/cases/router_5_6_3.py | amccool/openthread | 1e9d3c1dbfd66aa48c4cbb1dda0b41c9f05fefc7 | [
"BSD-3-Clause"
] | null | null | null | tools/harness-automation/cases/router_5_6_3.py | amccool/openthread | 1e9d3c1dbfd66aa48c4cbb1dda0b41c9f05fefc7 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
#
# Copyright (c) 2016, Nest Labs, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this ... | 42.906977 | 77 | 0.768022 |
from autothreadharness.harness_case import HarnessCase
import unittest
class Router_5_6_3(HarnessCase):
suite = 2
case = '5 6 3'
golden_devices_required = 3
def on_dialog(self, dialog, title):
pass
if __name__ == '__main__':
unittest.main()
| true | true |
f74ad274cac4a548434406023cafa435a314ba28 | 996 | py | Python | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna | 6c7d9099e0d766e7b30936ef25d32c1414133b96 | [
"Apache-2.0"
] | 13 | 2020-05-12T06:32:51.000Z | 2022-01-24T18:21:19.000Z | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna | 6c7d9099e0d766e7b30936ef25d32c1414133b96 | [
"Apache-2.0"
] | 5 | 2020-02-14T12:51:07.000Z | 2021-12-01T10:39:51.000Z | arjuna-samples/arjex/test/pkg/rules/helpers.py | StefanIGit/arjuna | 6c7d9099e0d766e7b30936ef25d32c1414133b96 | [
"Apache-2.0"
] | 25 | 2020-01-16T10:44:25.000Z | 2022-02-24T13:22:22.000Z | # This file is a part of Arjuna
# Copyright 2015-2021 Rahul Verma
# Website: www.RahulVerma.net
# 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... | 27.666667 | 74 | 0.703815 |
from arjuna.engine.selection.selector import Selector
def get_rule(r):
selector = Selector()
selector.include(r)
rule = selector.irules[0]
print(rule)
return rule
class Empty:
pass
class Obj:
def __init__(self):
self.info = Empty()
self.tags = set... | true | true |
f74ad431ba76dd79205e203670c5e222cd51cd37 | 2,858 | py | Python | sbd/sbd.py | am-zed/sbd | cbd358f030a606d341fbf43c8747636b001b641e | [
"MIT"
] | null | null | null | sbd/sbd.py | am-zed/sbd | cbd358f030a606d341fbf43c8747636b001b641e | [
"MIT"
] | null | null | null | sbd/sbd.py | am-zed/sbd | cbd358f030a606d341fbf43c8747636b001b641e | [
"MIT"
] | null | null | null | import argparse
import os
import pdfkit
import re
import validators
from robobrowser import RoboBrowser
def remove_non_ascii_chars(text):
return re.sub(r'[^\x00-\x7F]+', ' ', text)
base_url = 'https://learning.oreilly.com'
parser = argparse.ArgumentParser(
description='A small program to download books fro... | 33.232558 | 116 | 0.613716 | import argparse
import os
import pdfkit
import re
import validators
from robobrowser import RoboBrowser
def remove_non_ascii_chars(text):
return re.sub(r'[^\x00-\x7F]+', ' ', text)
base_url = 'https://learning.oreilly.com'
parser = argparse.ArgumentParser(
description='A small program to download books fro... | true | true |
f74ad4648b930ef617786c51a483a8e75bc14b1e | 1,213 | py | Python | src/utils/removeImg/testRemoveImg.py | FelipeRhoden/gifscreen | dc6a84bd3e72f30b8fa63ee2acaf5ca32d6de8ea | [
"MIT"
] | null | null | null | src/utils/removeImg/testRemoveImg.py | FelipeRhoden/gifscreen | dc6a84bd3e72f30b8fa63ee2acaf5ca32d6de8ea | [
"MIT"
] | 1 | 2021-06-30T12:47:39.000Z | 2021-06-30T13:10:17.000Z | src/utils/removeImg/testRemoveImg.py | FelipeRhoden/gifscreen | dc6a84bd3e72f30b8fa63ee2acaf5ca32d6de8ea | [
"MIT"
] | null | null | null | import unittest, os.path, os
from PIL import ImageGrab
from .removeImg import remove_img
class TestRemove_img(unittest.TestCase):
# Deveria excluir uma imagem
def test_remove_img_remove(self):
img = ImageGrab.grab((0,0,500,500))
path = "tmp.png"
img.save(path)
img.close()
pathExists = os.path.... | 28.209302 | 49 | 0.64798 | import unittest, os.path, os
from PIL import ImageGrab
from .removeImg import remove_img
class TestRemove_img(unittest.TestCase):
def test_remove_img_remove(self):
img = ImageGrab.grab((0,0,500,500))
path = "tmp.png"
img.save(path)
img.close()
pathExists = os.path.exists(path)
self.assert... | true | true |
f74ad7179d1547d8d9b78022548c24f441589c54 | 303 | py | Python | settings.py | googlewaitme/tg_quote_bot | 72a14e4d473fb859f2cb03a37c2647246bf1bbe2 | [
"MIT"
] | null | null | null | settings.py | googlewaitme/tg_quote_bot | 72a14e4d473fb859f2cb03a37c2647246bf1bbe2 | [
"MIT"
] | null | null | null | settings.py | googlewaitme/tg_quote_bot | 72a14e4d473fb859f2cb03a37c2647246bf1bbe2 | [
"MIT"
] | null | null | null | import os
token = os.environ.get('telegram_token')
channel_chat_id = '-1001479800791'
help_text = """Привет!
Это чат-бот "Мудрые слова".
Нажмите на /quote, для того, чтобы получить новую цитату.
Подписывайтесь на наш телеграм канал @amit_thoughts, чтобы получать ежедневно дозу мудрости.
Удачи!
"""
| 21.642857 | 92 | 0.762376 | import os
token = os.environ.get('telegram_token')
channel_chat_id = '-1001479800791'
help_text = """Привет!
Это чат-бот "Мудрые слова".
Нажмите на /quote, для того, чтобы получить новую цитату.
Подписывайтесь на наш телеграм канал @amit_thoughts, чтобы получать ежедневно дозу мудрости.
Удачи!
"""
| true | true |
f74ad84c8732bc331e47cf8a0bdb048686ddb531 | 184 | py | Python | main_Simple.py | eliezeravihail/linkedList | 5d50fc44433d61171bf51741d3b00357b628b26c | [
"MIT"
] | null | null | null | main_Simple.py | eliezeravihail/linkedList | 5d50fc44433d61171bf51741d3b00357b628b26c | [
"MIT"
] | null | null | null | main_Simple.py | eliezeravihail/linkedList | 5d50fc44433d61171bf51741d3b00357b628b26c | [
"MIT"
] | null | null | null | import linkedList as L
myLL = L.linkedList()
myLL.pushToHead("last item")
myLL.pushToHead("first item")
print(myLL.popFirst())
print(myLL.popFirst())
#output:
#first item
#last item
| 15.333333 | 29 | 0.73913 | import linkedList as L
myLL = L.linkedList()
myLL.pushToHead("last item")
myLL.pushToHead("first item")
print(myLL.popFirst())
print(myLL.popFirst())
| true | true |
f74ada1593d91177e744617ce8926d18d8c5fcdf | 5,821 | py | Python | shaka/tools/version.py | hunter-packages/shaka-player-embedded | ea50a18b337abd5e02ab5c8e06280d36c1ad8fdf | [
"Apache-2.0"
] | null | null | null | shaka/tools/version.py | hunter-packages/shaka-player-embedded | ea50a18b337abd5e02ab5c8e06280d36c1ad8fdf | [
"Apache-2.0"
] | null | null | null | shaka/tools/version.py | hunter-packages/shaka-player-embedded | ea50a18b337abd5e02ab5c8e06280d36c1ad8fdf | [
"Apache-2.0"
] | 6 | 2019-05-02T07:24:53.000Z | 2021-07-01T07:51:27.000Z | #!/usr/bin/python
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | 33.454023 | 80 | 0.650576 |
from __future__ import print_function
import argparse
import os
import re
import subprocess
import sys
import embed_utils
_MAX_VERSION = 2**16 - 1
_MAX_COMMITS = 2**12 - 1
_MAX_BETA_VERSION = 2**3 - 1
def _GetVersion():
if True:
return 'v0.1.0-beta'
try:
cur_dir = os.path.dirname... | true | true |
f74adc68509ca24ab166e48d54da66f523355831 | 1,509 | py | Python | gmprocess/metrics/transform/differentiate.py | norfordb/groundmotion | 3f714894a34d9d37e1ac236f26b4366e25a05056 | [
"CC0-1.0"
] | 1 | 2019-08-16T16:11:23.000Z | 2019-08-16T16:11:23.000Z | gmprocess/metrics/transform/differentiate.py | vinceq-usgs/gmprocess | 2812dfd1803f8b2e0622c56cd8373b1c3fedb1a6 | [
"CC0-1.0"
] | null | null | null | gmprocess/metrics/transform/differentiate.py | vinceq-usgs/gmprocess | 2812dfd1803f8b2e0622c56cd8373b1c3fedb1a6 | [
"CC0-1.0"
] | null | null | null | # Third party imports
from gmprocess.metrics.transform.transform import Transform
from gmprocess.stationstream import StationStream
from gmprocess.stationtrace import StationTrace
class Differentiate(Transform):
"""Class for computing the derivative."""
def __init__(self, transform_data, damping=None, period=... | 38.692308 | 81 | 0.634195 |
from gmprocess.metrics.transform.transform import Transform
from gmprocess.stationstream import StationStream
from gmprocess.stationtrace import StationTrace
class Differentiate(Transform):
def __init__(self, transform_data, damping=None, period=None, times=None):
super().__init__(transform_data, damping... | true | true |
f74addb4fd01a2ba7399f188f440e60b97adbfb5 | 3,698 | py | Python | python/smap/jobs.py | carlosduarteroa/smap | 5760631dfaf3e85da26ce68bf542bf254bb92c80 | [
"BSD-2-Clause"
] | null | null | null | python/smap/jobs.py | carlosduarteroa/smap | 5760631dfaf3e85da26ce68bf542bf254bb92c80 | [
"BSD-2-Clause"
] | null | null | null | python/smap/jobs.py | carlosduarteroa/smap | 5760631dfaf3e85da26ce68bf542bf254bb92c80 | [
"BSD-2-Clause"
] | null | null | null | """
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... | 34.886792 | 76 | 0.632504 | import time
from twisted.internet import task, reactor, defer
from smap import util
class SmapJob:
def __init__(self, job):
self.name = job['Name'] if 'Name' in job else None
self.after = job['After'] if 'After' in job else None
self.start_time = job['StartTime'] if 'StartTime' in job el... | true | true |
f74adef3c7549ceb687f58ffe9259fd6253dbd89 | 1,465 | py | Python | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev | 5c09e754f06645a438ff37e8c558475c2684d3a6 | [
"BSD-3-Clause"
] | null | null | null | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev | 5c09e754f06645a438ff37e8c558475c2684d3a6 | [
"BSD-3-Clause"
] | null | null | null | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev | 5c09e754f06645a438ff37e8c558475c2684d3a6 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This is rumdom run node.
subscribe No topcs.
Publish 'cmd_vel' topic.
mainly use for simple sample program
by Takuya Yamaguhi.
'''
import rospy
import random
from geometry_msgs.msg import Twist
class RandomBot():
def __init__(self, bot_name="NoName"):
... | 21.544118 | 70 | 0.529693 |
import rospy
import random
from geometry_msgs.msg import Twist
class RandomBot():
def __init__(self, bot_name="NoName"):
self.name = bot_name
self.vel_pub = rospy.Publisher('cmd_vel', Twist,queue_size=1)
def calcTwist(self):
value = random.randint(1,1000)
... | true | true |
f74adf7e356179a1e22c12b40900af3a993375e0 | 812 | py | Python | duello/urls.py | Lnvictor/duello | a59dbb43b9158bcb1a9e3824d4846b3a673aabc5 | [
"Apache-2.0"
] | null | null | null | duello/urls.py | Lnvictor/duello | a59dbb43b9158bcb1a9e3824d4846b3a673aabc5 | [
"Apache-2.0"
] | null | null | null | duello/urls.py | Lnvictor/duello | a59dbb43b9158bcb1a9e3824d4846b3a673aabc5 | [
"Apache-2.0"
] | null | null | null | """duello URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | 35.304348 | 77 | 0.705665 | from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("auth/", include("duello.custom_auth.urls")),
]
| true | true |
f74ae39c3444d276705c0d2af60413a53f6f2206 | 28,582 | py | Python | kivy/config.py | DamonTung/kivy | 81f573ef8de4c341cbf4d7c389f783c36eec91ce | [
"MIT"
] | 1 | 2015-11-05T18:32:14.000Z | 2015-11-05T18:32:14.000Z | kivy/config.py | waderly/kivy | 1bfa50bcbe83350f42f002bc217d381e4878666d | [
"MIT"
] | null | null | null | kivy/config.py | waderly/kivy | 1bfa50bcbe83350f42f002bc217d381e4878666d | [
"MIT"
] | null | null | null | '''
Configuration object
====================
The :class:`Config` object is an instance of a modified Python ConfigParser.
See the `ConfigParser documentation
<http://docs.python.org/library/configparser.html>`_ for more information.
Kivy has a configuration file which determines the default settings. In
order to cha... | 38.365101 | 79 | 0.625149 |
__all__ = ('Config', 'ConfigParser')
try:
from ConfigParser import ConfigParser as PythonConfigParser
except ImportError:
from configparser import RawConfigParser as PythonConfigParser
from os import environ
from os.path import exists
from kivy import kivy_config_fn
from kivy.logger import Logger, logger_conf... | true | true |
f74ae3fe033f7ab85beb25972ec28e355ac8796b | 10,965 | py | Python | Models/Electricity_Market/Tiers/V001/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | 2 | 2018-05-31T15:02:08.000Z | 2018-07-11T11:02:44.000Z | Models/Electricity_Market/Tiers/V001/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | null | null | null | Models/Electricity_Market/Tiers/V001/model.py | schmocker/Pyjamas | 52a72d6e8b915f77a2194d4e7d53c46d0ec28c17 | [
"MIT"
] | null | null | null | from pyjamas_core import Supermodel
from pyjamas_core.util import Input, Output, Property
from datetime import datetime, timedelta
from Models._utils.time import datetime2utc_time, utc_time2datetime
import numpy as np
from pytz import timezone
import json
from scipy.interpolate import griddata
import pandas as pd
impor... | 39.584838 | 150 | 0.540264 | from pyjamas_core import Supermodel
from pyjamas_core.util import Input, Output, Property
from datetime import datetime, timedelta
from Models._utils.time import datetime2utc_time, utc_time2datetime
import numpy as np
from pytz import timezone
import json
from scipy.interpolate import griddata
import pandas as pd
impor... | true | true |
f74ae48e90f874d6c83be4ce7ecca29772e876c8 | 28,862 | py | Python | Contents/Libraries/Shared/guessit/rules/properties/episodes.py | jippo015/Sub-Zero.bundle | 734e0f7128c05c0f639e11e7dfc77daa1014064b | [
"MIT"
] | 1,553 | 2015-11-09T02:17:06.000Z | 2022-03-31T20:24:52.000Z | Contents/Libraries/Shared/guessit/rules/properties/episodes.py | saiterlz/Sub-Zero.bundle | 1a0bb9c3e4be84be35d46672907783363fe5a87b | [
"MIT"
] | 691 | 2015-11-05T21:32:26.000Z | 2022-03-17T10:52:45.000Z | Contents/Libraries/Shared/guessit/rules/properties/episodes.py | saiterlz/Sub-Zero.bundle | 1a0bb9c3e4be84be35d46672907783363fe5a87b | [
"MIT"
] | 162 | 2015-11-06T19:38:55.000Z | 2022-03-16T02:42:41.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
episode, season, episode_count, season_count and episode_details properties
"""
import copy
from collections import defaultdict
from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch
from rebulk.match import Match
from rebulk.remodule import re
from reb... | 43.271364 | 120 | 0.584436 |
import copy
from collections import defaultdict
from rebulk import Rebulk, RemoveMatch, Rule, AppendMatch, RenameMatch
from rebulk.match import Match
from rebulk.remodule import re
from rebulk.utils import is_iterable
from .title import TitleFromPosition
from ..common import dash, alt_dash, seps
from ..common.forma... | true | true |
f74ae49f4be1a7ef5b666c3c8d701b06aa1710ec | 2,405 | py | Python | Utils/DiscreteLog.py | 636F57/CryptoAttackers | f6dae7f5c37ab563774a3e2be48dcd840d87bb12 | [
"MIT"
] | 1 | 2021-09-02T10:40:35.000Z | 2021-09-02T10:40:35.000Z | Utils/DiscreteLog.py | 636F57/CryptoAttackers | f6dae7f5c37ab563774a3e2be48dcd840d87bb12 | [
"MIT"
] | null | null | null | Utils/DiscreteLog.py | 636F57/CryptoAttackers | f6dae7f5c37ab563774a3e2be48dcd840d87bb12 | [
"MIT"
] | null | null | null | ### DiscreteLog.py
###
### Compute x when given h, g prime p, and the range of x [0 <= x <= max], such that g**x = h mod p
###
### This uses meet-in-the-middle-attack, namely, expand x as x = x0 * sqrt(max) + x1, find x0 and x1
### such that h/(g**x1) == (g**sqrt(max) )**x0 in mod p, by exausive attack.
###
### MIT L... | 23.578431 | 100 | 0.597089 | , "wb")
pickle.dump(table, fw)
fw.close()
print("Table data saved.", tablefilename)
else:
table = createTable(g, p, B)
if len(table) == 0:
print("No table data.")
return None
x0 = -1
x1 = -1
hh = mpz(h) % p
gg = mpz(g) % p
print("Looking up the table...")
progressbase = int(B/10)
gg_tmp... | true | true |
f74ae4ea694e8b977b4a225c39ec359e201361f4 | 7,532 | py | Python | train.py | Leon-Francis/Script-role-emotion-recognition | e80b8366f1e868b6611c149ad18945a994784b3d | [
"Apache-2.0"
] | null | null | null | train.py | Leon-Francis/Script-role-emotion-recognition | e80b8366f1e868b6611c149ad18945a994784b3d | [
"Apache-2.0"
] | null | null | null | train.py | Leon-Francis/Script-role-emotion-recognition | e80b8366f1e868b6611c149ad18945a994784b3d | [
"Apache-2.0"
] | null | null | null | import torch
import tqdm
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch import optim, nn
from dataset import Script_dataset
from config import TrainingConfig, CONFIG_PATH
from model import BaseModel
from tools import logging, get_time
from datetime import datetime
import os
from shut... | 44.305882 | 138 | 0.63436 | import torch
import tqdm
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torch import optim, nn
from dataset import Script_dataset
from config import TrainingConfig, CONFIG_PATH
from model import BaseModel
from tools import logging, get_time
from datetime import datetime
import os
from shut... | true | true |
f74ae5755de54a86a55a02fd50e0b96274be7717 | 4,977 | py | Python | src/olympia/constants/permissions.py | kumar303/addons-server | 5494bfdb4801e87220d17e35e0fa2ab4f017eac9 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/constants/permissions.py | kumar303/addons-server | 5494bfdb4801e87220d17e35e0fa2ab4f017eac9 | [
"BSD-3-Clause"
] | null | null | null | src/olympia/constants/permissions.py | kumar303/addons-server | 5494bfdb4801e87220d17e35e0fa2ab4f017eac9 | [
"BSD-3-Clause"
] | null | null | null | from collections import defaultdict, namedtuple
AclPermission = namedtuple('AclPermission', 'app, action')
# Null rule. Only useful in tests really as no access group should have this.
NONE = AclPermission('None', 'None')
# A special wildcard permission to use when checking if someone has access to
# any admin, or... | 39.5 | 79 | 0.768535 | from collections import defaultdict, namedtuple
AclPermission = namedtuple('AclPermission', 'app, action')
NONE = AclPermission('None', 'None')
ANY_ADMIN = AclPermission('Admin', '%')
SUPERPOWERS = AclPermission('*', '*')
ADMIN_TOOLS = AclPermission('Admin', 'Tools')
ADMIN_CURATION = AclPermission('Admin'... | true | true |
f74ae6513d015fb3e2e8361e7e84c4ca9b4c573c | 1,003 | py | Python | Docker/openroberta/scripts/reporting/workflows-test.py | Klkoenig217/openroberta-lab | eb2cab36809fe0d97f717c08588e4089bf8f2028 | [
"Apache-2.0"
] | 96 | 2019-04-29T18:58:11.000Z | 2022-03-21T02:47:33.000Z | Docker/openroberta/scripts/reporting/workflows-test.py | Klkoenig217/openroberta-lab | eb2cab36809fe0d97f717c08588e4089bf8f2028 | [
"Apache-2.0"
] | 1,113 | 2019-04-17T07:49:24.000Z | 2022-03-30T11:22:46.000Z | Docker/openroberta/scripts/reporting/workflows-test.py | Klkoenig217/openroberta-lab | eb2cab36809fe0d97f717c08588e4089bf8f2028 | [
"Apache-2.0"
] | 179 | 2019-05-08T19:52:43.000Z | 2022-03-18T11:30:27.000Z | '''
test/debug the reporting program w.t.h. of this file :-)
@author: rbudde
'''
from datetime import datetime
import time
from util import *
from store import *
from entry import *
if __name__ == "__main__":
logDir = "D:/data/openroberta-lab/server/master/admin/logging/statistics-2020"
logFile = "01.log.zi... | 32.354839 | 119 | 0.659023 |
from datetime import datetime
import time
from util import *
from store import *
from entry import *
if __name__ == "__main__":
logDir = "D:/data/openroberta-lab/server/master/admin/logging/statistics-2020"
logFile = "01.log.zip"
outputFileHandle = open("D:/temp/testoutput.txt", 'w')
printer = lambda ... | true | true |
f74ae6b9925457538b16177136de3888adde735b | 1,635 | py | Python | tensorflow_datasets/scripts/cli/main.py | rushabh-v/datasets | eccdf9dd2b8741e1d2500ae7edb0cb7f5cd59da4 | [
"Apache-2.0"
] | 2 | 2020-10-12T07:09:38.000Z | 2021-03-05T12:48:23.000Z | tensorflow_datasets/scripts/cli/main.py | rushabh-v/datasets | eccdf9dd2b8741e1d2500ae7edb0cb7f5cd59da4 | [
"Apache-2.0"
] | null | null | null | tensorflow_datasets/scripts/cli/main.py | rushabh-v/datasets | eccdf9dd2b8741e1d2500ae7edb0cb7f5cd59da4 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors.
#
# 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 appl... | 28.189655 | 78 | 0.729052 |
import argparse
from typing import List
from absl import app
from absl.flags import argparse_flags
import tensorflow_datasets.public_api as tfds
def _parse_flags(argv: List[str]) -> argparse.Namespace:
parser = argparse_flags.ArgumentParser(
description='Tensorflow Datasets CLI tool',
)
... | true | true |
f74ae8436093cfb5d3427035d1521fc06ffb872b | 272 | py | Python | chapter-07/app/src/server.py | khtan-private/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques | faf64da8bcbc48a1a860902adff6622fec22d52b | [
"MIT"
] | null | null | null | chapter-07/app/src/server.py | khtan-private/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques | faf64da8bcbc48a1a860902adff6622fec22d52b | [
"MIT"
] | null | null | null | chapter-07/app/src/server.py | khtan-private/Windows-Subsystem-for-Linux-2-WSL-2-Tips-Tricks-and-Techniques | faf64da8bcbc48a1a860902adff6622fec22d52b | [
"MIT"
] | null | null | null | import datetime
from platform import uname
from flask import Flask
server = Flask(__name__)
@server.route("/")
def getgreeting():
return uname()[0] + " | " + uname()[1] + " | " + str(datetime.datetime.now())
if __name__ == "__main__":
server.run(host='0.0.0.0')
| 22.666667 | 81 | 0.647059 | import datetime
from platform import uname
from flask import Flask
server = Flask(__name__)
@server.route("/")
def getgreeting():
return uname()[0] + " | " + uname()[1] + " | " + str(datetime.datetime.now())
if __name__ == "__main__":
server.run(host='0.0.0.0')
| true | true |
f74ae888d573f2dfd19cfa0540751033711781e9 | 4,806 | py | Python | AutomatedTesting/Gem/PythonTests/AWS/common/aws_credentials.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T12:39:24.000Z | 2021-07-20T12:39:24.000Z | AutomatedTesting/Gem/PythonTests/AWS/common/aws_credentials.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | null | null | null | AutomatedTesting/Gem/PythonTests/AWS/common/aws_credentials.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T11:07:25.000Z | 2021-07-20T11:07:25.000Z | """
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import boto3
import configparser
import logging
import os
import pytest
import typing
logger = lo... | 43.690909 | 156 | 0.677278 |
import boto3
import configparser
import logging
import os
import pytest
import typing
logger = logging.getLogger(__name__)
logging.getLogger('boto').setLevel(logging.CRITICAL)
class AwsCredentials:
def __init__(self, profile_name: str):
self._profile_name = profile_name
self._cr... | true | true |
f74ae8b94b2f7f4382a11f46fc71d42e3de1d9ac | 1,114 | py | Python | tests/__init__.py | bcdev/ocdb-client | c7d620e00f33fe0cdc7711178e83f789791fd4f8 | [
"MIT"
] | null | null | null | tests/__init__.py | bcdev/ocdb-client | c7d620e00f33fe0cdc7711178e83f789791fd4f8 | [
"MIT"
] | 1 | 2019-06-21T09:43:01.000Z | 2019-06-21T09:43:01.000Z | eocdb/core/seabass/__init__.py | bcdev/ocdb-server | 027078f2b022a06b3a417d76d273514a72f8cac7 | [
"MIT"
] | null | null | null | # The MIT License (MIT)
# Copyright (c) 2018 by EUMETSAT
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify,... | 53.047619 | 81 | 0.777379 | true | true | |
f74ae93b8cc6518cf4988a26caf259e0bc802844 | 564 | py | Python | drawer.py | janakhpon/LearnPyDacity | b096f9a50496a0c01353bf953209e766de312187 | [
"MIT"
] | null | null | null | drawer.py | janakhpon/LearnPyDacity | b096f9a50496a0c01353bf953209e766de312187 | [
"MIT"
] | null | null | null | drawer.py | janakhpon/LearnPyDacity | b096f9a50496a0c01353bf953209e766de312187 | [
"MIT"
] | null | null | null | import turtle
def draw_square(some_turtle):
for i in range(1,5):
some_turtle.forward(100)
some_turtle.right(90)
def draw_art():
window = turtle.Screen()
window.bgcolor("blue")
img_tt = turtle.Turtle()
img_tt.shape("turtle")
img_tt.color("white")
img_tt.speed(2)
for i in... | 20.142857 | 32 | 0.611702 | import turtle
def draw_square(some_turtle):
for i in range(1,5):
some_turtle.forward(100)
some_turtle.right(90)
def draw_art():
window = turtle.Screen()
window.bgcolor("blue")
img_tt = turtle.Turtle()
img_tt.shape("turtle")
img_tt.color("white")
img_tt.speed(2)
for i in... | true | true |
f74ae9c9e53bc414e5245b8a46d222773bdd1843 | 4,936 | py | Python | aoide/make_sky_mask.py | granttremblay/aoide | ea25bdf92013f7dc3b254e261039c43e697ee901 | [
"MIT"
] | 1 | 2018-06-26T12:28:39.000Z | 2018-06-26T12:28:39.000Z | aoide/make_sky_mask.py | granttremblay/Aoide | ea25bdf92013f7dc3b254e261039c43e697ee901 | [
"MIT"
] | null | null | null | aoide/make_sky_mask.py | granttremblay/Aoide | ea25bdf92013f7dc3b254e261039c43e697ee901 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
'''
Aoide | Reduction & Analysis of MUSE observations
-------------------------------------------------
Dr. Grant R. Tremblay | Harvard-Smithsonian Center for Astrophysics
grant.tremblay @ cfa.harvard.edu
See the README associated with this repository for documentation & examples.
'''
from __fu... | 30.097561 | 81 | 0.586507 |
from __future__ import print_function
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
from astropy.io import fits as pyfits
class MaskFrame:
def __init__(self, image, mask_name, cuts=(0, 10), extension=0):
fits_ima = pyfits.open(image)
self.true_arr = fits_ima[exten... | true | true |
f74aec0e09f15795a7e7e273ca1d959c7365d83c | 13,433 | py | Python | src/python/pants/goal/context.py | oseemann/pants | 628c83d5ab2706b0f64d69568c57a718ec7c5e2a | [
"Apache-2.0"
] | null | null | null | src/python/pants/goal/context.py | oseemann/pants | 628c83d5ab2706b0f64d69568c57a718ec7c5e2a | [
"Apache-2.0"
] | null | null | null | src/python/pants/goal/context.py | oseemann/pants | 628c83d5ab2706b0f64d69568c57a718ec7c5e2a | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys... | 36.903846 | 109 | 0.711457 |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import sys
from collections import defaultdict
from contextlib import contextmanager
from twitter.common.collections import OrderedSet
from pants.base.... | true | true |
f74aec0efe87e5b1b82fad66f95d170f748c878f | 1,324 | py | Python | homeassistant/helpers/__init__.py | PiotrMachowski/core | b9d7d0cae2ccd2d88e90e49cc09e154a27ed809b | [
"Apache-2.0"
] | 4 | 2021-07-11T09:11:00.000Z | 2022-02-27T14:43:50.000Z | homeassistant/helpers/__init__.py | PiotrMachowski/core | b9d7d0cae2ccd2d88e90e49cc09e154a27ed809b | [
"Apache-2.0"
] | 277 | 2021-10-04T06:39:33.000Z | 2021-12-28T22:04:17.000Z | homeassistant/helpers/__init__.py | PiotrMachowski/core | b9d7d0cae2ccd2d88e90e49cc09e154a27ed809b | [
"Apache-2.0"
] | 1 | 2022-02-09T00:30:51.000Z | 2022-02-09T00:30:51.000Z | """Helper methods for components within Home Assistant."""
from __future__ import annotations
from collections.abc import Iterable, Sequence
import re
from typing import TYPE_CHECKING
from homeassistant.const import CONF_PLATFORM
if TYPE_CHECKING:
from .typing import ConfigType
def config_per_platform(
con... | 28.170213 | 77 | 0.664653 | from __future__ import annotations
from collections.abc import Iterable, Sequence
import re
from typing import TYPE_CHECKING
from homeassistant.const import CONF_PLATFORM
if TYPE_CHECKING:
from .typing import ConfigType
def config_per_platform(
config: ConfigType, domain: str
) -> Iterable[tuple[str | None... | true | true |
f74aecabba20f69b5f769ea05bb45d921238aa3e | 701 | py | Python | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python | 25d0008596cfc7b895f367d36de5dd95b6722b4c | [
"Apache-2.0"
] | 1 | 2018-08-14T16:29:57.000Z | 2018-08-14T16:29:57.000Z | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python | 25d0008596cfc7b895f367d36de5dd95b6722b4c | [
"Apache-2.0"
] | null | null | null | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python | 25d0008596cfc7b895f367d36de5dd95b6722b4c | [
"Apache-2.0"
] | null | null | null | from nose.plugins.attrib import attr
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_error():
"""
test_dummy_known_bad_with_assertion_error
I'd like to buy the world a Dr Pepper!
"""
assert False
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad... | 24.172414 | 48 | 0.71184 | from nose.plugins.attrib import attr
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_error():
assert False
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_pass():
assert True
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_... | true | true |
f74aed8886340987aea7be736b1cb328fe7edd71 | 26,079 | py | Python | image_classification/PiT/main_multi_gpu_distill.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | image_classification/PiT/main_multi_gpu_distill.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | image_classification/PiT/main_multi_gpu_distill.py | RangeKing/PaddleViT | 0e25958686e04ed8872cf67fba0dfd6918e9b4dd | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 44.732419 | 100 | 0.622647 |
import sys
import os
import time
import argparse
import random
import math
import numpy as np
import paddle
from datasets import get_dataloader
from datasets import get_dataset
from config import get_config
from config import update_config
from utils import AverageMeter
from utils import get_logger
from u... | true | true |
f74aee7f8711e0d20ddae7ba72df63f17d3c27c5 | 3,471 | py | Python | saleor/graphql/discount/filters.py | shannenye/saleor | f6a2d35fd8ae8d614edd952cd5c58adb82e56ab2 | [
"CC-BY-4.0"
] | 3 | 2021-06-22T12:38:18.000Z | 2021-07-11T15:01:57.000Z | saleor/graphql/discount/filters.py | shannenye/saleor | f6a2d35fd8ae8d614edd952cd5c58adb82e56ab2 | [
"CC-BY-4.0"
] | 111 | 2021-07-19T04:19:30.000Z | 2022-03-28T04:32:37.000Z | saleor/graphql/discount/filters.py | shannenye/saleor | f6a2d35fd8ae8d614edd952cd5c58adb82e56ab2 | [
"CC-BY-4.0"
] | 6 | 2021-11-08T16:43:05.000Z | 2022-03-22T17:31:16.000Z | from typing import List
import django_filters
from django.db.models import Q
from django.utils import timezone
from ...discount import DiscountValueType
from ...discount.models import Sale, Voucher, VoucherQueryset
from ..core.filters import ListObjectTypeFilter, ObjectTypeFilter
from ..core.types.common import DateT... | 33.375 | 88 | 0.721694 | from typing import List
import django_filters
from django.db.models import Q
from django.utils import timezone
from ...discount import DiscountValueType
from ...discount.models import Sale, Voucher, VoucherQueryset
from ..core.filters import ListObjectTypeFilter, ObjectTypeFilter
from ..core.types.common import DateT... | true | true |
f74aefc2910220fdbeb939c89be3ba2fa5ea25fe | 5,330 | py | Python | tests20/python_client/chaos/checker.py | reyoung/milvus | 7557616fea7ff7a8b093c85a5c17134112fa89f8 | [
"Apache-2.0"
] | null | null | null | tests20/python_client/chaos/checker.py | reyoung/milvus | 7557616fea7ff7a8b093c85a5c17134112fa89f8 | [
"Apache-2.0"
] | null | null | null | tests20/python_client/chaos/checker.py | reyoung/milvus | 7557616fea7ff7a8b093c85a5c17134112fa89f8 | [
"Apache-2.0"
] | null | null | null | import datetime
from enum import Enum
from random import randint
from time import sleep
from base.collection_wrapper import ApiCollectionWrapper
from common import common_func as cf
from common import common_type as ct
import constants
from utils.util_log import test_log as log
class Op(Enum):
create = 'create'
... | 34.166667 | 104 | 0.549719 | import datetime
from enum import Enum
from random import randint
from time import sleep
from base.collection_wrapper import ApiCollectionWrapper
from common import common_func as cf
from common import common_type as ct
import constants
from utils.util_log import test_log as log
class Op(Enum):
create = 'create'
... | true | true |
f74af1aa72de9a35ade54b2b54bc9b70c67fb025 | 1,779 | py | Python | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina | 9c9af3cd2982daabc75dd3d3e2f380e17c21aac0 | [
"Apache-2.0"
] | 1 | 2020-11-14T09:54:09.000Z | 2020-11-14T09:54:09.000Z | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina | 9c9af3cd2982daabc75dd3d3e2f380e17c21aac0 | [
"Apache-2.0"
] | null | null | null | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina | 9c9af3cd2982daabc75dd3d3e2f380e17c21aac0 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import pytest
from jina.executors.evaluators.rank.recall import RecallEvaluator
@pytest.mark.parametrize(
'eval_at, expected',
[
(0, 0.0),
(1, 0.2),
(2, 0.4),
(3, 0.4),
(5, 0.4),
(100, 0.4)
]
)
def test_recall_evaluator(eval_at, expected)... | 28.693548 | 94 | 0.63294 | import numpy as np
import pytest
from jina.executors.evaluators.rank.recall import RecallEvaluator
@pytest.mark.parametrize(
'eval_at, expected',
[
(0, 0.0),
(1, 0.2),
(2, 0.4),
(3, 0.4),
(5, 0.4),
(100, 0.4)
]
)
def test_recall_evaluator(eval_at, expected)... | true | true |
f74af1d8c79bf465f60e37098f6bd8abba93c664 | 7,180 | py | Python | frappe/website/doctype/web_page/web_page.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | frappe/website/doctype/web_page/web_page.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | frappe/website/doctype/web_page/web_page.py | oryxsolutions/frappe | d193ea22d17ca40d57432040a8afad72287d9e23 | [
"MIT"
] | null | null | null | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import re
from jinja2.exceptions import TemplateSyntaxError
import frappe
from frappe import _
from frappe.utils import get_datetime, now, quoted, strip_html
from frappe.utils.jinja import render_template
from frappe.uti... | 30.553191 | 96 | 0.724373 |
import re
from jinja2.exceptions import TemplateSyntaxError
import frappe
from frappe import _
from frappe.utils import get_datetime, now, quoted, strip_html
from frappe.utils.jinja import render_template
from frappe.utils.safe_exec import safe_exec
from frappe.website.doctype.website_slideshow.website_slideshow i... | true | true |
f74af1f2e1bb7051265e45fb7499f4d303c49795 | 12,528 | py | Python | lib/export_utils.py | nahidupa/grr | 100a9d85ef2abb234e12e3ac2623caffb4116be7 | [
"Apache-2.0"
] | 1 | 2016-02-13T15:40:20.000Z | 2016-02-13T15:40:20.000Z | lib/export_utils.py | nahidupa/grr | 100a9d85ef2abb234e12e3ac2623caffb4116be7 | [
"Apache-2.0"
] | 3 | 2020-09-11T12:54:50.000Z | 2020-09-11T12:55:01.000Z | lib/export_utils.py | nahidupa/grr | 100a9d85ef2abb234e12e3ac2623caffb4116be7 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Utils exporting data from AFF4 to the rest of the world."""
import os
import Queue
import stat
import time
import logging
from grr.lib import aff4
from grr.lib import rdfvalue
from grr.lib import serialize
from grr.lib import threadpool
from... | 33.587131 | 79 | 0.668183 |
import os
import Queue
import stat
import time
import logging
from grr.lib import aff4
from grr.lib import rdfvalue
from grr.lib import serialize
from grr.lib import threadpool
from grr.lib import type_info
from grr.lib import utils
from grr.lib.aff4_objects import aff4_grr
BUFFER_SIZE = 16 * 1024 * 1024
def ... | true | true |
f74af20681e6b242051dfdd5a340429508ec18cc | 36,834 | py | Python | redex.py | Harry-L/redex | c5696c06727ff9cb79279a08a3bae0f4553bd04c | [
"MIT"
] | null | null | null | redex.py | Harry-L/redex | c5696c06727ff9cb79279a08a3bae0f4553bd04c | [
"MIT"
] | null | null | null | redex.py | Harry-L/redex | c5696c06727ff9cb79279a08a3bae0f4553bd04c | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import distutils.version
import enum
import errno
import fnmatch
import glob
import itertools
import js... | 32.113339 | 109 | 0.618613 |
import argparse
import distutils.version
import enum
import errno
import fnmatch
import glob
import itertools
import json
import os
import platform
import re
import shutil
import signal
import struct
import subprocess
import sys
import tempfile
import timeit
import zipfile
from os.path import abspath, basename, d... | true | true |
f74af2f8877992abad5ae65c701b25ff09e559ac | 1,605 | py | Python | solutions/0494/0494.py | abawchen/leetcode | 41d3b172a7694a46a860fbcb0565a3acccd000f2 | [
"MIT"
] | null | null | null | solutions/0494/0494.py | abawchen/leetcode | 41d3b172a7694a46a860fbcb0565a3acccd000f2 | [
"MIT"
] | null | null | null | solutions/0494/0494.py | abawchen/leetcode | 41d3b172a7694a46a860fbcb0565a3acccd000f2 | [
"MIT"
] | null | null | null | import unittest
from collections import defaultdict
class Solution:
def findTargetSumWays(self, nums: list[int], target: int) -> int:
dps = []
dp = defaultdict(int, {nums[0]: 1})
dp[-nums[0]] += 1
dps.append(dp)
for i in range(1, len(nums)):
dp = defaultdict(i... | 25.47619 | 69 | 0.555763 | import unittest
from collections import defaultdict
class Solution:
def findTargetSumWays(self, nums: list[int], target: int) -> int:
dps = []
dp = defaultdict(int, {nums[0]: 1})
dp[-nums[0]] += 1
dps.append(dp)
for i in range(1, len(nums)):
dp = defaultdict(i... | true | true |
f74af44f6844165f528484ac745b02d9dd476cd8 | 1,246 | py | Python | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner | ee68bbf2bd2f1ec4d2e4163c6ec794005a4a8f1c | [
"BSD-3-Clause"
] | 6 | 2016-12-05T21:27:30.000Z | 2018-07-26T18:19:33.000Z | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner | ee68bbf2bd2f1ec4d2e4163c6ec794005a4a8f1c | [
"BSD-3-Clause"
] | 3 | 2016-12-22T07:50:29.000Z | 2018-05-03T10:43:21.000Z | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner | ee68bbf2bd2f1ec4d2e4163c6ec794005a4a8f1c | [
"BSD-3-Clause"
] | 3 | 2017-07-23T12:50:43.000Z | 2018-04-22T11:26:53.000Z | #!/usr/bin/env python
#
# File Name : bleu.py
#
# Description : Wrapper for BLEU scorer.
#
# Creation Date : 06-01-2015
# Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
from bleu_scorer import BleuScorer
class Bleu:
def __init__(self, n=4... | 25.958333 | 79 | 0.58427 |
from bleu_scorer import BleuScorer
class Bleu:
def __init__(self, n=4):
self._n = n
self._hypo_for_image = {}
self.ref_for_image = {}
def compute_score(self, gts, res):
assert(gts.keys() == res.keys())
imgIds = gts.keys()
bleu_scorer = Bleu... | true | true |
f74af63f5ccfd54b66af7b96b0177756056c6157 | 240 | py | Python | iterations/enumerate.py | SeanSyue/PythonReferences | 103b2d6934a33e56a5d8fbb14d95282f572b3af7 | [
"MIT"
] | null | null | null | iterations/enumerate.py | SeanSyue/PythonReferences | 103b2d6934a33e56a5d8fbb14d95282f572b3af7 | [
"MIT"
] | null | null | null | iterations/enumerate.py | SeanSyue/PythonReferences | 103b2d6934a33e56a5d8fbb14d95282f572b3af7 | [
"MIT"
] | null | null | null | seasons = ['Spring', 'Summer', 'Fall', 'Winter']
enum = enumerate(seasons)
print(enum)
print(type(enum))
print(list(enum))
my_list = ['apple', 'banana', 'grapes', 'pear']
for c, value in enumerate(my_list, 1):
print(c, value)
| 24 | 49 | 0.629167 | seasons = ['Spring', 'Summer', 'Fall', 'Winter']
enum = enumerate(seasons)
print(enum)
print(type(enum))
print(list(enum))
my_list = ['apple', 'banana', 'grapes', 'pear']
for c, value in enumerate(my_list, 1):
print(c, value)
| true | true |
f74af6452a233b7c3ad8e4cf9cfcb57cf4c2e40c | 780 | py | Python | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 544 | 2016-08-04T17:10:16.000Z | 2022-03-31T07:17:20.000Z | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 438 | 2016-10-11T12:24:22.000Z | 2022-03-31T19:30:35.000Z | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client | ca7bfa1b22212137bb4e984c0457632163e89a43 | [
"MIT"
] | 202 | 2016-08-22T19:29:40.000Z | 2022-03-30T20:26:15.000Z | from office365.runtime.client_value import ClientValue
class SPSiteCreationRequest(ClientValue):
def __init__(self, title, url, owner=None):
super(SPSiteCreationRequest, self).__init__()
self.Title = title
self.Url = url
self.WebTemplate = "SITEPAGEPUBLISHING#0"
self.Owner... | 33.913043 | 76 | 0.685897 | from office365.runtime.client_value import ClientValue
class SPSiteCreationRequest(ClientValue):
def __init__(self, title, url, owner=None):
super(SPSiteCreationRequest, self).__init__()
self.Title = title
self.Url = url
self.WebTemplate = "SITEPAGEPUBLISHING#0"
self.Owner... | true | true |
f74af70518fb9eab848d5769836ad85621c4c561 | 1,774 | py | Python | py2/Problem008.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | py2/Problem008.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | py2/Problem008.py | DanielGarrett/ProjectEuler | ca23f4dbfb2a47ea663fb0858630d3e2fb3b9764 | [
"MIT"
] | null | null | null | import EulerRunner
digits = ('73167176531330624919225119674426574742355349194934'
+ '96983520312774506326239578318016984801869478851843'
+ '85861560789112949495459501737958331952853208805511'
+ '12540698747158523863050715693290963295227443043557'
+ '66896648950445244523161731856403098711121722383113'
+ '62229893423380... | 36.958333 | 62 | 0.73788 | import EulerRunner
digits = ('73167176531330624919225119674426574742355349194934'
+ '96983520312774506326239578318016984801869478851843'
+ '85861560789112949495459501737958331952853208805511'
+ '12540698747158523863050715693290963295227443043557'
+ '66896648950445244523161731856403098711121722383113'
+ '62229893423380... | true | true |
f74af7ee1f2ba08f20273655e630797fa13e7593 | 3,881 | py | Python | src/spiegelib/features/spectral_summarized.py | spiegel-lib/spiegel | 2a0b606a2f9eba22e25ade96ece249b790ca3b23 | [
"MIT"
] | 10 | 2020-11-12T16:11:03.000Z | 2022-02-02T12:18:07.000Z | src/spiegelib/features/spectral_summarized.py | spiegel-lib/spiegel | 2a0b606a2f9eba22e25ade96ece249b790ca3b23 | [
"MIT"
] | 3 | 2020-12-04T01:43:40.000Z | 2021-02-19T17:08:57.000Z | src/spiegelib/features/spectral_summarized.py | spiegel-lib/spiegel | 2a0b606a2f9eba22e25ade96ece249b790ca3b23 | [
"MIT"
] | 3 | 2020-07-04T02:24:15.000Z | 2021-09-08T14:01:36.000Z | #!/usr/bin/env python
"""
Spectral features summarized over time using mean and variance. Returns a 22-dimension
feature vector for each audio sample.
Features:
- Spectral Centroid
- Spectral Bandwidth
- Spectral Contrast (7 frequency bands)
- Spectral Flatness
- Spectral Rolloff
"""
import numpy ... | 32.341667 | 94 | 0.603195 |
import numpy as np
import librosa
from spiegelib import AudioBuffer
from spiegelib.features.features_base import FeaturesBase
class SpectralSummarized(FeaturesBase):
def __init__(self, frame_size=2048, hop_size=512, scale_axis=0, **kwargs):
self.frame_size = frame_size
self.hop_size = hop_size
... | true | true |
f74afa451689493e81b62e4936de3989f3093218 | 7,909 | py | Python | src/sage/structure/graphics_file.py | switzel/sage | 7eb8510dacf61b691664cd8f1d2e75e5d473e5a0 | [
"BSL-1.0"
] | 2 | 2018-06-30T01:37:35.000Z | 2018-06-30T01:37:39.000Z | src/sage/structure/graphics_file.py | switzel/sage | 7eb8510dacf61b691664cd8f1d2e75e5d473e5a0 | [
"BSL-1.0"
] | null | null | null | src/sage/structure/graphics_file.py | switzel/sage | 7eb8510dacf61b691664cd8f1d2e75e5d473e5a0 | [
"BSL-1.0"
] | 1 | 2020-07-24T12:20:37.000Z | 2020-07-24T12:20:37.000Z | # -*- coding: utf-8 -*-
"""
Wrapper for Graphics Files
"""
import os
import six
from sage.misc.temporary_file import tmp_filename
from sage.structure.sage_object import SageObject
import sage.doctest
class Mime(object):
TEXT = u'text/plain'
HTML = u'text/html'
LATEX = u'text/latex'
JSON = u'applicat... | 28.76 | 80 | 0.595398 |
import os
import six
from sage.misc.temporary_file import tmp_filename
from sage.structure.sage_object import SageObject
import sage.doctest
class Mime(object):
TEXT = u'text/plain'
HTML = u'text/html'
LATEX = u'text/latex'
JSON = u'application/json'
JAVASCRIPT = u'application/javascript'
P... | true | true |
f74afa5a75bece73499bbe9af1f9903872f12e59 | 173 | py | Python | app/api/v1/__init__.py | camisatx/flasker | affc9fc13742e18434961b8ec15f133cc246dcd5 | [
"MIT"
] | 3 | 2020-12-12T01:30:08.000Z | 2021-10-13T16:47:56.000Z | app/api/v1/__init__.py | camisatx/flasker | affc9fc13742e18434961b8ec15f133cc246dcd5 | [
"MIT"
] | null | null | null | app/api/v1/__init__.py | camisatx/flasker | affc9fc13742e18434961b8ec15f133cc246dcd5 | [
"MIT"
] | 1 | 2020-12-12T01:30:13.000Z | 2020-12-12T01:30:13.000Z | from flask import Blueprint
bp = Blueprint('api.v1', __name__)
# NOTE: Add extra blueprint routes to this import list
from app.api.v1 import errors, planes, tokens, users
| 24.714286 | 54 | 0.763006 | from flask import Blueprint
bp = Blueprint('api.v1', __name__)
from app.api.v1 import errors, planes, tokens, users
| true | true |
f74afa61ddd8d7cdea133c649cbdf4a809db20e9 | 7,514 | py | Python | utils/data_utils.py | HaowenWeiJohn/RealityNavigationRealTimeInference | cef6906d939f56c88ea38e4394f13f35f055e3d9 | [
"MIT"
] | null | null | null | utils/data_utils.py | HaowenWeiJohn/RealityNavigationRealTimeInference | cef6906d939f56c88ea38e4394f13f35f055e3d9 | [
"MIT"
] | null | null | null | utils/data_utils.py | HaowenWeiJohn/RealityNavigationRealTimeInference | cef6906d939f56c88ea38e4394f13f35f055e3d9 | [
"MIT"
] | null | null | null | import os
from pathlib import Path
import cv2
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import resample
from utils.sig_proc_utils import notch_filter, baseline_correction
def window_slice(data, window_size, stride, channel_mode='channel_last'):
a... | 38.731959 | 129 | 0.640671 | import os
from pathlib import Path
import cv2
import matplotlib.pyplot as plt
import numpy as np
from scipy.interpolate import interp1d
from scipy.signal import resample
from utils.sig_proc_utils import notch_filter, baseline_correction
def window_slice(data, window_size, stride, channel_mode='channel_last'):
a... | true | true |
f74afb3bdcd2813c6d45b4b20fed367a9513b91f | 4,947 | py | Python | provisioning/migrations/0001_initial.py | UniversitaDellaCalabria/IdM | 0c80bc1a192e8f3075c941ca2d89773bca25e892 | [
"Apache-2.0"
] | 2 | 2020-03-02T23:03:16.000Z | 2020-07-13T06:04:04.000Z | provisioning/migrations/0001_initial.py | UniversitaDellaCalabria/IdM | 0c80bc1a192e8f3075c941ca2d89773bca25e892 | [
"Apache-2.0"
] | 7 | 2020-01-28T15:57:35.000Z | 2020-07-01T15:16:46.000Z | provisioning/migrations/0001_initial.py | UniversitaDellaCalabria/IdM | 0c80bc1a192e8f3075c941ca2d89773bca25e892 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.1.4 on 2019-02-18 14:37
from django.db import migrations, models
import django.db.models.deletion
import provisioning.utils
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('identity', '0001_initial'),
]
operations = [
migr... | 53.193548 | 118 | 0.596725 |
from django.db import migrations, models
import django.db.models.deletion
import provisioning.utils
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('identity', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='IdentityC... | true | true |
f74afbfa8f596f701446f2d996a460cdc6aa8f84 | 3,728 | py | Python | doc/examples/tractography_clustering.py | stefanv/dipy | 4d4518861a796502826f053c17161487db126487 | [
"BSD-3-Clause"
] | 3 | 2015-07-31T20:43:18.000Z | 2019-07-26T13:58:07.000Z | doc/examples/tractography_clustering.py | stefanv/dipy | 4d4518861a796502826f053c17161487db126487 | [
"BSD-3-Clause"
] | 9 | 2015-05-13T17:44:42.000Z | 2018-05-27T20:09:55.000Z | doc/examples/tractography_clustering.py | stefanv/dipy | 4d4518861a796502826f053c17161487db126487 | [
"BSD-3-Clause"
] | 3 | 2016-08-05T22:43:16.000Z | 2017-06-23T18:35:13.000Z | """
=============================
Tractography Clustering
=============================
Overview
========
**This example gives a tour of clustering related features of dipy.**
First import the necessary modules
----------------------------------
``numpy`` is for numerical computation
"""
import numpy as np
imp... | 21.181818 | 188 | 0.681599 |
import numpy as np
import time
from nibabel import trackvis as tv
from dipy.tracking import metrics as tm
from dipy.tracking import distances as td
from dipy.io import pickles as pkl
from dipy.viz import fvtk
from dipy.data import get_data
fname=get_data('fornix')
print(fname)
streams,hdr=tv.read(fname)
T=... | true | true |
f74afc33e502ba8e34969cad5087711b714abd0b | 3,845 | py | Python | mistral/tests/unit/engine/test_noop_task.py | ISCAS-VDI/mistral-base | 630dd8c2c3f8b939cf91bf4b3bf6bf1d9aa8174b | [
"Apache-2.0"
] | null | null | null | mistral/tests/unit/engine/test_noop_task.py | ISCAS-VDI/mistral-base | 630dd8c2c3f8b939cf91bf4b3bf6bf1d9aa8174b | [
"Apache-2.0"
] | null | null | null | mistral/tests/unit/engine/test_noop_task.py | ISCAS-VDI/mistral-base | 630dd8c2c3f8b939cf91bf4b3bf6bf1d9aa8174b | [
"Apache-2.0"
] | null | null | null | # Copyright 2014 - Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | 29.576923 | 78 | 0.653056 |
from oslo_config import cfg
from mistral.db.v2 import api as db_api
from mistral.services import workflows as wf_service
from mistral.tests.unit.engine import base
from mistral.workflow import states
cfg.CONF.set_default('auth_enable', False, group='pecan')
WF = """
---
version: '2.0'
wf:
type: di... | true | true |
f74afc8c695825eba0587ed97050c58479d608f6 | 4,134 | py | Python | cvxpy/reductions/solvers/qp_solvers/qp_solver.py | dougalsutherland/cvxpy | 34349b5e41c124a6a1e32426e68af95b5044498c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cvxpy/reductions/solvers/qp_solvers/qp_solver.py | dougalsutherland/cvxpy | 34349b5e41c124a6a1e32426e68af95b5044498c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cvxpy/reductions/solvers/qp_solvers/qp_solver.py | dougalsutherland/cvxpy | 34349b5e41c124a6a1e32426e68af95b5044498c | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | """
Copyright 2017 Robin Verschueren
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, softw... | 35.033898 | 76 | 0.620464 |
import numpy as np
import scipy.sparse as sp
from cvxpy.atoms.affine.add_expr import AddExpression
from cvxpy.atoms.affine.binary_operators import MulExpression
from cvxpy.atoms.quad_form import QuadForm
from cvxpy.constraints import NonPos, Zero
from cvxpy.problems.objective import Minimize
from cvxpy.reductions imp... | true | true |
f74afd14e7293a78f600277ccbdb6a9611e4bfc2 | 1,516 | py | Python | src/seg_model_utils/torchio_transforms.py | jpjuvo/RSNA-MICCAI-Brain-Tumor-Classification | a8a4e9257b7475bc328870504edd18fdd9ec9d2f | [
"MIT"
] | 1 | 2021-10-20T19:34:27.000Z | 2021-10-20T19:34:27.000Z | src/seg_model_utils/torchio_transforms.py | jpjuvo/RSNA-MICCAI-Brain-Tumor-Classification | a8a4e9257b7475bc328870504edd18fdd9ec9d2f | [
"MIT"
] | null | null | null | src/seg_model_utils/torchio_transforms.py | jpjuvo/RSNA-MICCAI-Brain-Tumor-Classification | a8a4e9257b7475bc328870504edd18fdd9ec9d2f | [
"MIT"
] | null | null | null | import torch
import torchio as tio
import numpy as np
def load_tio_image(fn):
"""
ScalarImage(shape: (c, w, h, d))
dtype: torch.DoubleTensor
"""
arr = np.load(fn).swapaxes(0,3)
return tio.ScalarImage(tensor=arr)
def arr_2_tio_image(arr):
"""
ScalarImage(shape: (c, w, h, d))
dtype: ... | 28.074074 | 78 | 0.653034 | import torch
import torchio as tio
import numpy as np
def load_tio_image(fn):
arr = np.load(fn).swapaxes(0,3)
return tio.ScalarImage(tensor=arr)
def arr_2_tio_image(arr):
arr = arr.swapaxes(0,3)
return tio.ScalarImage(tensor=arr)
def load_tio_seg_image(fn):
if fn is None:
return None
... | true | true |
f74afd5a9882fe2229b72623c208357c4aabf2a3 | 1,776 | py | Python | recommendation/recommendation/apps/films/models.py | WillionLei/recommendation | 49fd28a47574877a91458201b21ec2a80409bb5f | [
"MIT"
] | null | null | null | recommendation/recommendation/apps/films/models.py | WillionLei/recommendation | 49fd28a47574877a91458201b21ec2a80409bb5f | [
"MIT"
] | null | null | null | recommendation/recommendation/apps/films/models.py | WillionLei/recommendation | 49fd28a47574877a91458201b21ec2a80409bb5f | [
"MIT"
] | null | null | null | from BaseModel.BaseModel import BaseModel
from django.db import models
from levels.models import Level
class FilmCategory(models.Model):
"""电影类别表"""
name = models.CharField(max_length=50, verbose_name='名称')
class Meta:
db_table = 'tb_film_category'
verbose_name = '电影类别'
verbose_n... | 37.787234 | 98 | 0.684685 | from BaseModel.BaseModel import BaseModel
from django.db import models
from levels.models import Level
class FilmCategory(models.Model):
name = models.CharField(max_length=50, verbose_name='名称')
class Meta:
db_table = 'tb_film_category'
verbose_name = '电影类别'
verbose_name_plural = ver... | true | true |
f74b0037b3b040cd8b224b0b2fbdf1df12cde31e | 343 | py | Python | minidump/streams/CommentStreamA.py | lucasg/minidump | 18474e3221038abe866256e4e0eb255e33615110 | [
"MIT"
] | 1 | 2021-06-13T10:00:44.000Z | 2021-06-13T10:00:44.000Z | minidump/streams/CommentStreamA.py | lucasg/minidump | 18474e3221038abe866256e4e0eb255e33615110 | [
"MIT"
] | null | null | null | minidump/streams/CommentStreamA.py | lucasg/minidump | 18474e3221038abe866256e4e0eb255e33615110 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
class CommentStreamA:
def __init__(self):
self.data = None
@staticmethod
def parse(dir, buff):
csa = CommentStreamA()
buff.seek(dir.Location.Rva)
csa.data = buff.read(dir.Location.DataSize).decode()
return csa
def __str__(self):
return 'Co... | 19.055556 | 54 | 0.685131 |
class CommentStreamA:
def __init__(self):
self.data = None
@staticmethod
def parse(dir, buff):
csa = CommentStreamA()
buff.seek(dir.Location.Rva)
csa.data = buff.read(dir.Location.DataSize).decode()
return csa
def __str__(self):
return 'CommentA: %s' % self.data | true | true |
f74b013939709a98796ec8d88e70aef91bfad120 | 1,215 | py | Python | data/p4VQE/R4/benchmark/startPyquil237.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startPyquil237.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | data/p4VQE/R4/benchmark/startPyquil237.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=11
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | 23.365385 | 64 | 0.607407 |
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program()
prog += H(0)
prog += H(1)
prog += RX(2.9845130209103035,2)
pro... | true | true |
f74b014dcf8719b3da87bc34679b15e0548a5339 | 1,321 | py | Python | slacker/commands/chat/chat_postephemeral_command.py | netromdk/slacker | 56ab630ba11451c254c5ec377f76033b692c61ce | [
"MIT"
] | 11 | 2018-04-18T05:57:37.000Z | 2021-12-15T09:39:56.000Z | slacker/commands/chat/chat_postephemeral_command.py | netromdk/slacker | 56ab630ba11451c254c5ec377f76033b692c61ce | [
"MIT"
] | 46 | 2018-02-04T06:52:53.000Z | 2018-10-28T19:55:21.000Z | slacker/commands/chat/chat_postephemeral_command.py | netromdk/slacker | 56ab630ba11451c254c5ec377f76033b692c61ce | [
"MIT"
] | 1 | 2018-08-27T01:07:35.000Z | 2018-08-27T01:07:35.000Z | from slacker.commands.command import Command
from slacker.commands.argument_parser import ArgumentParser
class ChatPostEphemeralCommand(Command):
def name(self):
return "chat.postephemeral"
def description(self):
return "Post ephemeral message to a channel on Slack that is only visible to assigned user."
... | 36.694444 | 96 | 0.642695 | from slacker.commands.command import Command
from slacker.commands.argument_parser import ArgumentParser
class ChatPostEphemeralCommand(Command):
def name(self):
return "chat.postephemeral"
def description(self):
return "Post ephemeral message to a channel on Slack that is only visible to assigned user."
... | true | true |
f74b01a18ffc8697475c3b4305f2201ae3c62493 | 977 | py | Python | tts/src/test_tts.py | shivdeep-singh/conversational-ai-chatbot | b67802a96b3fe3d64457931a8cbf8bf03442fd0d | [
"BSD-3-Clause"
] | 11 | 2021-09-09T16:16:48.000Z | 2022-03-31T21:25:46.000Z | tts/src/test_tts.py | shivdeep-singh/conversational-ai-chatbot | b67802a96b3fe3d64457931a8cbf8bf03442fd0d | [
"BSD-3-Clause"
] | 1 | 2022-02-10T06:08:11.000Z | 2022-02-10T06:08:11.000Z | tts/src/test_tts.py | shivdeep-singh/conversational-ai-chatbot | b67802a96b3fe3d64457931a8cbf8bf03442fd0d | [
"BSD-3-Clause"
] | 12 | 2021-09-19T10:39:27.000Z | 2022-03-09T05:17:05.000Z | #!/usr/bin/env python3
"""
Copyright (C) 2021 Intel Corporation
SPDX-License-Identifier: BSD-3-Clause
"""
from tts_openvino.synthesizer import Synthesizer
class tacotron_tts:
def __init__(self):
duration_model = "/model/text-to-speech-en-0001-duration-prediction.xml"
regression_model = "/model/... | 28.735294 | 126 | 0.700102 |
from tts_openvino.synthesizer import Synthesizer
class tacotron_tts:
def __init__(self):
duration_model = "/model/text-to-speech-en-0001-duration-prediction.xml"
regression_model = "/model/text-to-speech-en-0001-regression.xml"
generation_model = "/model/text-to-speech-en-0001-generation... | true | true |
f74b01d3612ba71565bc824b5dcb6991d692917c | 17,154 | py | Python | biosaur2/utils.py | levitsky/biosaur2 | 5cc8474906408c58ff043af722607c1452aa444f | [
"Apache-2.0"
] | null | null | null | biosaur2/utils.py | levitsky/biosaur2 | 5cc8474906408c58ff043af722607c1452aa444f | [
"Apache-2.0"
] | null | null | null | biosaur2/utils.py | levitsky/biosaur2 | 5cc8474906408c58ff043af722607c1452aa444f | [
"Apache-2.0"
] | 1 | 2022-02-15T13:13:46.000Z | 2022-02-15T13:13:46.000Z | from pyteomics import mzml
import numpy as np
from collections import defaultdict, Counter
from os import path
import math
from scipy.optimize import curve_fit
import logging
logger = logging.getLogger(__name__)
from .cutils import get_fast_dict, get_and_calc_apex_intensity_and_scan
class MS1OnlyMzML(mzml.MzML):
... | 36.420382 | 143 | 0.57695 | from pyteomics import mzml
import numpy as np
from collections import defaultdict, Counter
from os import path
import math
from scipy.optimize import curve_fit
import logging
logger = logging.getLogger(__name__)
from .cutils import get_fast_dict, get_and_calc_apex_intensity_and_scan
class MS1OnlyMzML(mzml.MzML):
... | true | true |
f74b02a525cdf45ccbfce6e741feeeef7f23a780 | 643 | py | Python | Base/__init__.py | asd778623877/Automat-test | cdfad2b35daf8cf728f5d35175a8d1642bcba35c | [
"Apache-2.0"
] | 1 | 2020-04-25T14:00:58.000Z | 2020-04-25T14:00:58.000Z | Base/__init__.py | asd778623877/Automat-test | cdfad2b35daf8cf728f5d35175a8d1642bcba35c | [
"Apache-2.0"
] | null | null | null | Base/__init__.py | asd778623877/Automat-test | cdfad2b35daf8cf728f5d35175a8d1642bcba35c | [
"Apache-2.0"
] | null | null | null | from appium import webdriver
def init_driver():
desired_caps = {}
# 设备信息
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '7.0'
desired_caps['deviceName'] = 'A02YECPH27MHJ'
# app的信息com.ecaray.epark.xiangyang com.ecaray.epark.xiangyang.ui.GuideActivity
desired_caps[... | 37.823529 | 82 | 0.709176 | from appium import webdriver
def init_driver():
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '7.0'
desired_caps['deviceName'] = 'A02YECPH27MHJ'
desired_caps['appPackage'] = 'com.mobilefly.pda'
desired_caps['appActivity'] = 'com.mobilefly... | true | true |
f74b0371d60401bf1795098a345a4f5364f3d43a | 145,948 | py | Python | gremlin-python/src/main/python/radish/gremlin.py | CarlSample/tinkerpop | f38f06941b91193c6e608e5499f4a42fa2050711 | [
"Apache-2.0"
] | null | null | null | gremlin-python/src/main/python/radish/gremlin.py | CarlSample/tinkerpop | f38f06941b91193c6e608e5499f4a42fa2050711 | [
"Apache-2.0"
] | 5 | 2022-03-17T03:25:05.000Z | 2022-03-17T03:25:18.000Z | gremlin-python/src/main/python/radish/gremlin.py | CarlSample/tinkerpop | f38f06941b91193c6e608e5499f4a42fa2050711 | [
"Apache-2.0"
] | 1 | 2021-07-11T01:22:01.000Z | 2021-07-11T01:22:01.000Z | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | 218.158445 | 3,984 | 0.701222 |
__.out()).name)],
'g_V_repeatXgroupCountXmX_byXnameX_outX_timesX2X_capXmX': [(lambda g:g.V().repeat(__.groupCount('m').by('name').out()).times(2).cap('m'))],
'g_VX1X_repeatXgroupCountXmX_byXloopsX_outX_timesX3X_capXmX': [(lambda g, vid1=None:g.V(vid1).repeat(__.groupCount('m').by(__.loops... | true | true |
f74b03dc94255ff8aa90f86c22863e9795f7211a | 5,732 | py | Python | robustness/attack_steps.py | kaczmarj/robustness | 79d371fd799885ea5fe5553c2b749f41de1a2c4e | [
"MIT"
] | 695 | 2019-08-21T18:32:11.000Z | 2022-03-30T12:08:19.000Z | robustness/attack_steps.py | kaczmarj/robustness | 79d371fd799885ea5fe5553c2b749f41de1a2c4e | [
"MIT"
] | 78 | 2019-08-23T15:00:42.000Z | 2022-02-03T13:04:31.000Z | robustness/attack_steps.py | kaczmarj/robustness | 79d371fd799885ea5fe5553c2b749f41de1a2c4e | [
"MIT"
] | 146 | 2019-08-21T19:13:57.000Z | 2022-03-31T07:13:31.000Z | """
**For most use cases, this can just be considered an internal class and
ignored.**
This module contains the abstract class AttackerStep as well as a few subclasses.
AttackerStep is a generic way to implement optimizers specifically for use with
:class:`robustness.attacker.AttackerModel`. In general, except for w... | 27.690821 | 96 | 0.569435 |
import torch as ch
class AttackerStep:
def __init__(self, orig_input, eps, step_size, use_grad=True):
self.orig_input = orig_input
self.eps = eps
self.step_size = step_size
self.use_grad = use_grad
def project(self, x):
raise NotImplementedError
def step(self, x, ... | true | true |
f74b0435f9e96c68fe881c05016977a70fa5bd8f | 2,182 | py | Python | H07/sws-homework-07/code/csp.py | akshay-ap/SWSHomeowork | 8d9ab131dfa43526be65162a1f2b67982a33381c | [
"Apache-2.0"
] | null | null | null | H07/sws-homework-07/code/csp.py | akshay-ap/SWSHomeowork | 8d9ab131dfa43526be65162a1f2b67982a33381c | [
"Apache-2.0"
] | null | null | null | H07/sws-homework-07/code/csp.py | akshay-ap/SWSHomeowork | 8d9ab131dfa43526be65162a1f2b67982a33381c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
import sys
try:
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse, parse_qs
from html import escape
except ImportError:
sys.exit('ERROR: It seems like you are not running Python 3. '
'This script only works with Python 3!')
... | 27.620253 | 175 | 0.643905 |
import sys
try:
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse, parse_qs
from html import escape
except ImportError:
sys.exit('ERROR: It seems like you are not running Python 3. '
'This script only works with Python 3!')
main_doc = '''
<!doc... | true | true |
f74b043a29ce3c21833d1e0b6669d065705ba865 | 687 | py | Python | Easy/111 - Minimum Depth of Binary Tree.py | gizemkurtoglu/LeetCode | 5e4461e26b5d430c4ef50e7f820d22beea50a896 | [
"MIT"
] | 5 | 2022-01-03T10:22:26.000Z | 2022-02-20T05:05:17.000Z | Easy/111 - Minimum Depth of Binary Tree.py | gizemkurtoglu/LeetCode | 5e4461e26b5d430c4ef50e7f820d22beea50a896 | [
"MIT"
] | null | null | null | Easy/111 - Minimum Depth of Binary Tree.py | gizemkurtoglu/LeetCode | 5e4461e26b5d430c4ef50e7f820d22beea50a896 | [
"MIT"
] | null | null | null | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
from collections import deque
class Solution:
def minDepth(self, root: Optional[TreeNode]) -> int:
if not root:
... | 28.625 | 56 | 0.528384 |
from collections import deque
class Solution:
def minDepth(self, root: Optional[TreeNode]) -> int:
if not root:
return 0
else:
node_deque = deque([(1, root)])
while node_deque:
depth, node = node_deque.popleft()
children = [node.left, n... | true | true |
f74b046356cba24c2e196cc7f414500a6615c24a | 30,740 | py | Python | tencentcloud/aa/v20200224/models.py | snowxmas/tencentcloud-sdk-python | fb527dcfc6b52a210e79d581f85cb8cde1ea9c85 | [
"Apache-2.0"
] | 2 | 2021-07-10T09:40:16.000Z | 2022-02-04T09:01:22.000Z | tencentcloud/aa/v20200224/models.py | snowxmas/tencentcloud-sdk-python | fb527dcfc6b52a210e79d581f85cb8cde1ea9c85 | [
"Apache-2.0"
] | null | null | null | tencentcloud/aa/v20200224/models.py | snowxmas/tencentcloud-sdk-python | fb527dcfc6b52a210e79d581f85cb8cde1ea9c85 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf8 -*-
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | 32.121212 | 167 | 0.644795 |
from tencentcloud.common.abstract_model import AbstractModel
class AccountInfo(AbstractModel):
def __init__(self):
self.AccountType = None
self.QQAccount = None
self.WeChatAccount = None
self.OtherAccount = None
def _deserialize(self, params):
self.Acc... | true | true |
f74b048f4e87d93f1218d802f34e0db19a9e56bc | 1,925 | py | Python | monopoly_ai_sim/board.py | dgurjar/monopoly_ai_simulator | c7230b2d3bf1e70ecee642d87f6af7b7f9b87a40 | [
"MIT"
] | null | null | null | monopoly_ai_sim/board.py | dgurjar/monopoly_ai_simulator | c7230b2d3bf1e70ecee642d87f6af7b7f9b87a40 | [
"MIT"
] | null | null | null | monopoly_ai_sim/board.py | dgurjar/monopoly_ai_simulator | c7230b2d3bf1e70ecee642d87f6af7b7f9b87a40 | [
"MIT"
] | null | null | null | from enum import IntEnum
class RentIdx(IntEnum):
DEFAULT = ONLY_DEED = RAILROAD_1 = UTILITY_1 = 0
GROUP_COMPLETE_NO_HOUSES = RAILROAD_2 = UTILITY_2 = 1
HOUSE_1 = RAILROAD_3 = 2
HOUSE_2 = RAILROAD_4 = 3
HOUSE_3 = 4
HOUSE_4 = 5
HOTEL = MAX = 6
HOUSE_TO_HOTEL = HOTEL - HOUSE_1 + 1
# Rep... | 40.104167 | 106 | 0.620779 | from enum import IntEnum
class RentIdx(IntEnum):
DEFAULT = ONLY_DEED = RAILROAD_1 = UTILITY_1 = 0
GROUP_COMPLETE_NO_HOUSES = RAILROAD_2 = UTILITY_2 = 1
HOUSE_1 = RAILROAD_3 = 2
HOUSE_2 = RAILROAD_4 = 3
HOUSE_3 = 4
HOUSE_4 = 5
HOTEL = MAX = 6
HOUSE_TO_HOTEL = HOTEL - HOUSE_1 + 1
clas... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.