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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c486f1cf2689297fa04af34f08c7bca55b19f3d | 15,971 | py | Python | src/c4/cmany/project.py | biojppm/cmany | b20c24169d60077122ae29a0c09526913340fd5c | [
"MIT"
] | 20 | 2017-05-17T18:43:08.000Z | 2021-02-13T16:20:53.000Z | src/c4/cmany/project.py | biojppm/cmany | b20c24169d60077122ae29a0c09526913340fd5c | [
"MIT"
] | 8 | 2017-06-04T17:01:06.000Z | 2022-03-17T12:43:32.000Z | src/c4/cmany/project.py | biojppm/cmany | b20c24169d60077122ae29a0c09526913340fd5c | [
"MIT"
] | 1 | 2017-06-04T13:09:19.000Z | 2017-06-04T13:09:19.000Z | #!/usr/bin/env python3
import os
import glob
import json
import copy
import timeit
from collections import OrderedDict as odict
from ruamel import yaml as yaml
from ruamel.yaml.comments import CommentedMap as CommentedMap
from . import util
from . import conf
from .build_flags import BuildFlags
from .build_item imp... | 34.420259 | 108 | 0.508547 |
import os
import glob
import json
import copy
import timeit
from collections import OrderedDict as odict
from ruamel import yaml as yaml
from ruamel.yaml.comments import CommentedMap as CommentedMap
from . import util
from . import conf
from .build_flags import BuildFlags
from .build_item import BuildItem
from .bui... | true | true |
1c486f22ea70cd1af40bf4a804d81f728c367b5b | 10,630 | py | Python | salt/states/tomcat.py | yuriks/salt | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | [
"Apache-2.0",
"MIT"
] | 1 | 2020-03-31T22:51:16.000Z | 2020-03-31T22:51:16.000Z | salt/states/tomcat.py | yuriks/salt | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | [
"Apache-2.0",
"MIT"
] | null | null | null | salt/states/tomcat.py | yuriks/salt | d2a5bd8adddb98ec1718d79384aa13b4f37e8028 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-09-30T07:00:01.000Z | 2021-09-30T07:00:01.000Z | # -*- coding: utf-8 -*-
'''
Manage Apache Tomcat web applications
=====================================
.. note::
This state requires the Tomcat Manager webapp to be installed and running.
The following grains/pillars must be set for communication with Tomcat Manager
to work:
.. code-block:: yaml
tomcat-man... | 30.371429 | 114 | 0.564722 |
from __future__ import absolute_import, unicode_literals, print_function
from salt.ext import six
def __virtual__():
return 'tomcat' if 'tomcat.status' in __salt__ else False
def war_deployed(name,
war,
force=False,
url='http://localhost:8080/manager',
... | true | true |
1c486f58fa570c63d63f4cb3f130a23e65f259d7 | 7,188 | py | Python | bc/navigation/migrations/0001_initial.py | Buckinghamshire-Digital-Service/buckinghamshire-council | bbbdb52b515bcdfc79a2bd9198dfa4828405370e | [
"BSD-3-Clause"
] | 1 | 2021-02-27T07:27:17.000Z | 2021-02-27T07:27:17.000Z | bc/navigation/migrations/0001_initial.py | Buckinghamshire-Digital-Service/buckinghamshire-council | bbbdb52b515bcdfc79a2bd9198dfa4828405370e | [
"BSD-3-Clause"
] | null | null | null | bc/navigation/migrations/0001_initial.py | Buckinghamshire-Digital-Service/buckinghamshire-council | bbbdb52b515bcdfc79a2bd9198dfa4828405370e | [
"BSD-3-Clause"
] | 1 | 2021-06-09T15:56:54.000Z | 2021-06-09T15:56:54.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2017-12-20 09:28
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
initial = True
dependencie... | 43.041916 | 116 | 0.229967 | from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
initial = True
dependencies = [("wagtailcore", "0040_page_draft_title")]
operations = [
... | true | true |
1c48703c6ae531496c99cd091196e12d31f42352 | 787 | py | Python | src/aoc_day03.py | samuelrothen/advent_of_code_2020 | 22cfc62314d0d19fe91cd1e606064a8828ef0bc7 | [
"MIT"
] | 1 | 2021-01-24T21:17:22.000Z | 2021-01-24T21:17:22.000Z | src/aoc_day03.py | samuelrothen/advent_of_code_2020 | 22cfc62314d0d19fe91cd1e606064a8828ef0bc7 | [
"MIT"
] | null | null | null | src/aoc_day03.py | samuelrothen/advent_of_code_2020 | 22cfc62314d0d19fe91cd1e606064a8828ef0bc7 | [
"MIT"
] | null | null | null | # Advent of Code Day 3
def check_trees(tree_map, n_steps_r, n_steps_d):
x = 0
n_trees = 0
map_border = len(tree_map[0])
for y in range(0, len(tree_map)-1, n_steps_d):
x = (x + n_steps_r) % map_border
field = tree_map[n_steps_d + y][x]
if field == '#':
n_trees += 1
... | 23.848485 | 57 | 0.614994 |
def check_trees(tree_map, n_steps_r, n_steps_d):
x = 0
n_trees = 0
map_border = len(tree_map[0])
for y in range(0, len(tree_map)-1, n_steps_d):
x = (x + n_steps_r) % map_border
field = tree_map[n_steps_d + y][x]
if field == '#':
n_trees += 1
return n_trees
wit... | true | true |
1c4870e4e14175611c397b227767f34f313a3296 | 29,015 | py | Python | vnpy/trader/engine.py | crystalphi/vnpy | 14eb6ff626b07230830248ee6aea8923a5a887f4 | [
"MIT"
] | 1 | 2021-11-24T09:19:57.000Z | 2021-11-24T09:19:57.000Z | vnpy/trader/engine.py | crystalphi/vnpy | 14eb6ff626b07230830248ee6aea8923a5a887f4 | [
"MIT"
] | null | null | null | vnpy/trader/engine.py | crystalphi/vnpy | 14eb6ff626b07230830248ee6aea8923a5a887f4 | [
"MIT"
] | null | null | null | """
"""
import logging
from logging import Logger
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any, Sequence, Type, Dict, List, Optional
from vnpy.event import Event, Eve... | 32.131783 | 120 | 0.592418 |
import logging
from logging import Logger
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any, Sequence, Type, Dict, List, Optional
from vnpy.event import Event, EventEngine... | true | true |
1c4871f0c878ab1c35feefbb79fe50299bde90c4 | 729 | py | Python | apex/functions/notify/line_notify.py | Koichi-Kobayashi/aws_iot_line_notify | a745db492d01107b2b8675f6febe332bbb4307af | [
"Apache-2.0"
] | null | null | null | apex/functions/notify/line_notify.py | Koichi-Kobayashi/aws_iot_line_notify | a745db492d01107b2b8675f6febe332bbb4307af | [
"Apache-2.0"
] | null | null | null | apex/functions/notify/line_notify.py | Koichi-Kobayashi/aws_iot_line_notify | a745db492d01107b2b8675f6febe332bbb4307af | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import requests
import conf
def create_message(button_event):
if button_event['clickType'] == 'SINGLE':
msg = conf.clickType_single
elif button_event['clickType'] == 'DOUBLE':
msg = conf.clickType_double
else:
msg = conf.clickType_long
return msg
def... | 22.090909 | 59 | 0.657064 |
import requests
import conf
def create_message(button_event):
if button_event['clickType'] == 'SINGLE':
msg = conf.clickType_single
elif button_event['clickType'] == 'DOUBLE':
msg = conf.clickType_double
else:
msg = conf.clickType_long
return msg
def lambda_handler(event, c... | true | true |
1c48739fad3abf032b3b1f31759a4c33c5bb2c20 | 398 | py | Python | Chapter-2/Example_2-2.py | vishwesh5/Learning-OpenCV-Book | 59ad4e190274f92735075013e9276b8159d6ca2e | [
"MIT"
] | 2 | 2018-12-21T17:36:53.000Z | 2018-12-22T17:13:00.000Z | Chapter-2/Example_2-2.py | vishwesh5/Learning-OpenCV-Book | 59ad4e190274f92735075013e9276b8159d6ca2e | [
"MIT"
] | null | null | null | Chapter-2/Example_2-2.py | vishwesh5/Learning-OpenCV-Book | 59ad4e190274f92735075013e9276b8159d6ca2e | [
"MIT"
] | null | null | null | import cv2 as cv
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i","--image",required=True,\
help="Path to image")
args = vars(parser.parse_args())
img = cv.imread(args["image"])
if img is None:
print("Image not found")
else:
cv.namedWindow("Example2",cv.WINDOW_AUTOSIZE)
... | 22.111111 | 50 | 0.68593 | import cv2 as cv
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i","--image",required=True,\
help="Path to image")
args = vars(parser.parse_args())
img = cv.imread(args["image"])
if img is None:
print("Image not found")
else:
cv.namedWindow("Example2",cv.WINDOW_AUTOSIZE)
... | true | true |
1c48748ca246fef140c24024d9868d5f3ce278fb | 2,341 | py | Python | data_array.py | fogcitymarathoner/coconuts | b0d72c171dbc61c089ec3a352604093fbafc1f5d | [
"Unlicense"
] | null | null | null | data_array.py | fogcitymarathoner/coconuts | b0d72c171dbc61c089ec3a352604093fbafc1f5d | [
"Unlicense"
] | 1 | 2021-06-01T22:00:23.000Z | 2021-06-01T22:00:23.000Z | data_array.py | fogcitymarathoner/coconuts | b0d72c171dbc61c089ec3a352604093fbafc1f5d | [
"Unlicense"
] | null | null | null | __author__ = 'marc'
import json
from lib import load_flight_file
from lib import sort_streams_on_start_point
from lib import streams_average
from settings import FLIGHT_PATHS_FILE_JSON
from Data import Stream
class StreamArrayCalculator:
def __init__(self, raw_data):
sorted_streams ... | 33.927536 | 121 | 0.608714 | __author__ = 'marc'
import json
from lib import load_flight_file
from lib import sort_streams_on_start_point
from lib import streams_average
from settings import FLIGHT_PATHS_FILE_JSON
from Data import Stream
class StreamArrayCalculator:
def __init__(self, raw_data):
sorted_streams ... | true | true |
1c4874eef0849b4e7264b8fcb01cd8ffc5d9ca50 | 2,425 | py | Python | openbb_terminal/stocks/discovery/fidelity_view.py | joshuabuildsthings/GamestonkTerminal | 385d12803ae1725a22b0a440c3b88bffa974edcd | [
"MIT"
] | 255 | 2022-03-29T16:43:51.000Z | 2022-03-31T23:57:08.000Z | openbb_terminal/stocks/discovery/fidelity_view.py | joshuabuildsthings/GamestonkTerminal | 385d12803ae1725a22b0a440c3b88bffa974edcd | [
"MIT"
] | 14 | 2022-03-29T14:20:33.000Z | 2022-03-31T23:39:20.000Z | openbb_terminal/stocks/discovery/fidelity_view.py | joshuabuildsthings/GamestonkTerminal | 385d12803ae1725a22b0a440c3b88bffa974edcd | [
"MIT"
] | 24 | 2022-03-29T15:28:56.000Z | 2022-03-31T23:54:15.000Z | """ Fidelity View """
__docformat__ = "numpy"
import logging
import os
import re
import pandas as pd
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import export_data, print_rich_table
from openbb_terminal.stocks.discovery import fidelity_model
from openbb_terminal import rich... | 23.317308 | 77 | 0.629278 | __docformat__ = "numpy"
import logging
import os
import re
import pandas as pd
from openbb_terminal.decorators import log_start_end
from openbb_terminal.helper_funcs import export_data, print_rich_table
from openbb_terminal.stocks.discovery import fidelity_model
from openbb_terminal import rich_config
logger = logg... | true | true |
1c487618650e746bc8f6ffa044bd3bdf064b87c9 | 5,429 | py | Python | onmt/modules/linear.py | tuannamnguyen93/NMTGMinor | acde3454343bda7060fae541c110d0ad1a8ac4f4 | [
"MIT"
] | 4 | 2021-07-06T11:39:41.000Z | 2022-02-23T10:48:59.000Z | onmt/modules/linear.py | tuannamnguyen93/NMTGMinor | acde3454343bda7060fae541c110d0ad1a8ac4f4 | [
"MIT"
] | 2 | 2021-09-14T03:18:12.000Z | 2022-01-25T16:19:51.000Z | onmt/modules/linear.py | tuannamnguyen93/NMTGMinor | acde3454343bda7060fae541c110d0ad1a8ac4f4 | [
"MIT"
] | 1 | 2019-09-15T17:22:58.000Z | 2019-09-15T17:22:58.000Z | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.utils.weight_norm as WeightNorm
import onmt
import torch.nn.functional as F
from onmt.modules.swish import Swish
from onmt.modules.dropout import VariationalDropout
# different linears for the same input
def group_linear(linears, input, b... | 27.841026 | 77 | 0.596242 | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.utils.weight_norm as WeightNorm
import onmt
import torch.nn.functional as F
from onmt.modules.swish import Swish
from onmt.modules.dropout import VariationalDropout
def group_linear(linears, input, bias=False):
weights = [linear.weigh... | true | true |
1c487757682dc2e74fb94446cd1a0561e99ca49e | 3,616 | py | Python | tests/py/test_teams.py | webmaven/gratipay.com | 31f6bcf903029895a4c56290aedde755e852c82f | [
"CC0-1.0"
] | 1 | 2019-10-09T10:13:53.000Z | 2019-10-09T10:13:53.000Z | tests/py/test_teams.py | webmaven/gratipay.com | 31f6bcf903029895a4c56290aedde755e852c82f | [
"CC0-1.0"
] | null | null | null | tests/py/test_teams.py | webmaven/gratipay.com | 31f6bcf903029895a4c56290aedde755e852c82f | [
"CC0-1.0"
] | null | null | null | from __future__ import unicode_literals
from gratipay.models._mixin_team import StubParticipantAdded
from gratipay.testing import Harness
from gratipay.security.user import User
class Tests(Harness):
def setUp(self):
Harness.setUp(self)
self.team = self.make_participant('A-Team', number='plural'... | 38.468085 | 78 | 0.692754 | from __future__ import unicode_literals
from gratipay.models._mixin_team import StubParticipantAdded
from gratipay.testing import Harness
from gratipay.security.user import User
class Tests(Harness):
def setUp(self):
Harness.setUp(self)
self.team = self.make_participant('A-Team', number='plural'... | true | true |
1c4877c974b684dbdb7f4e4b039aebf0f1bb0990 | 2,923 | py | Python | client_code/ContactForm/_anvil_designer.py | benlawraus/pyDALAnvilWorks | 8edc67b0fbe65bdcc0ef6fd2424f55046cacba7c | [
"MIT"
] | 6 | 2021-11-14T22:49:40.000Z | 2022-03-26T17:40:40.000Z | client_code/ContactForm/_anvil_designer.py | benlawraus/pyDALAnvilWorks | 8edc67b0fbe65bdcc0ef6fd2424f55046cacba7c | [
"MIT"
] | null | null | null | client_code/ContactForm/_anvil_designer.py | benlawraus/pyDALAnvilWorks | 8edc67b0fbe65bdcc0ef6fd2424f55046cacba7c | [
"MIT"
] | 1 | 2022-01-31T01:18:32.000Z | 2022-01-31T01:18:32.000Z | from anvil import *
from dataclasses import dataclass, field
from ..EmailDisplayForm import EmailDisplayForm
label_name = dict(
role=None,
align='left',
tooltip='',
border='',
foreground='',
visible=True,
text='Name',
font_size=None,
font='',
spacing_above='small',
icon_alig... | 25.640351 | 114 | 0.677386 | from anvil import *
from dataclasses import dataclass, field
from ..EmailDisplayForm import EmailDisplayForm
label_name = dict(
role=None,
align='left',
tooltip='',
border='',
foreground='',
visible=True,
text='Name',
font_size=None,
font='',
spacing_above='small',
icon_alig... | true | true |
1c487922611e17b5fa948c3273cb3ae9b3d05521 | 4,944 | py | Python | Young_Massive_Stars/Code_v31_multiple/galaxy_generator/run_several_gala_v31.py | lhquirogan/Galactic_Maser_Simulator | cb74afd40b6d99429219c44114c74e150d3f5189 | [
"MIT"
] | null | null | null | Young_Massive_Stars/Code_v31_multiple/galaxy_generator/run_several_gala_v31.py | lhquirogan/Galactic_Maser_Simulator | cb74afd40b6d99429219c44114c74e150d3f5189 | [
"MIT"
] | null | null | null | Young_Massive_Stars/Code_v31_multiple/galaxy_generator/run_several_gala_v31.py | lhquirogan/Galactic_Maser_Simulator | cb74afd40b6d99429219c44114c74e150d3f5189 | [
"MIT"
] | null | null | null | import sys
from shutil import move
import os
import itertools
import shutil
kvar = raw_input("Do you want to make multiple file parameters (yes or no)? ")
if (kvar=='yes' or kvar=='y'):
def replace(file_path,file_path_old_, pattern0, pattern1, pattern2, pattern3, subst0, subst1, subst2,subst3):
with ... | 43.368421 | 169 | 0.499798 | import sys
from shutil import move
import os
import itertools
import shutil
kvar = raw_input("Do you want to make multiple file parameters (yes or no)? ")
if (kvar=='yes' or kvar=='y'):
def replace(file_path,file_path_old_, pattern0, pattern1, pattern2, pattern3, subst0, subst1, subst2,subst3):
with ... | true | true |
1c4879ab2de863efcac4c0599614b5a3a22db222 | 2,720 | py | Python | webapp/test_before_deploy.py | Kandy16/img-search-cnn | afc787e9284f1c8cb28beb2224bf076c04bb931f | [
"Apache-2.0"
] | 3 | 2017-12-04T12:31:18.000Z | 2018-08-12T23:45:55.000Z | webapp/test_before_deploy.py | Kandy16/img-search-cnn | afc787e9284f1c8cb28beb2224bf076c04bb931f | [
"Apache-2.0"
] | 1 | 2018-02-03T13:59:55.000Z | 2018-02-03T13:59:55.000Z | webapp/test_before_deploy.py | Kandy16/img-search-cnn | afc787e9284f1c8cb28beb2224bf076c04bb931f | [
"Apache-2.0"
] | 1 | 2019-03-12T10:43:06.000Z | 2019-03-12T10:43:06.000Z | import os
import config
from application.images_youtube_extract import ImagesYoutubeExtract
# --------------------Testing KNNN-----------------
#from ml.knn import knn
#obj = knn.KNN()
# print(obj.get_random_images(10))
#obj.prepare_data_for_KNN(config.KNN_IMG_VECTORS_FILEPATH , config.KNN_DATASET_PATH ... | 36.266667 | 161 | 0.744853 | import os
import config
from application.images_youtube_extract import ImagesYoutubeExtract
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database.models.models import QueryString, FeatureVectorsQueryString, ApplicationVideo, Base
engine =... | true | true |
1c487ab562135f15791357682cea196226852034 | 11,883 | py | Python | nbconvert/exporters/exporter.py | nelsonuhan/nbconvert | a534fb901ff83e0b0c0c082ff47f3de01dc651b1 | [
"BSD-3-Clause-Clear"
] | 2 | 2020-07-22T09:28:31.000Z | 2020-08-17T01:19:42.000Z | nbconvert/exporters/exporter.py | nelsonuhan/nbconvert | a534fb901ff83e0b0c0c082ff47f3de01dc651b1 | [
"BSD-3-Clause-Clear"
] | null | null | null | nbconvert/exporters/exporter.py | nelsonuhan/nbconvert | a534fb901ff83e0b0c0c082ff47f3de01dc651b1 | [
"BSD-3-Clause-Clear"
] | 3 | 2020-08-04T02:48:32.000Z | 2020-08-17T01:20:09.000Z | """This module defines a base Exporter class. For Jinja template-based export,
see templateexporter.py.
"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function, absolute_import
import io
import os
import copy
import collections
im... | 35.792169 | 112 | 0.621813 |
from __future__ import print_function, absolute_import
import io
import os
import copy
import collections
import datetime
import sys
import nbformat
from traitlets.config.configurable import LoggingConfigurable
from traitlets.config import Config
from traitlets import Bool, HasTraits, Unicode, List, TraitError
fro... | true | true |
1c487b0f893f8f2f4cdc98e8592bea273cb2890d | 1,069 | py | Python | hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py | maxpearl/hypha | e181ebadfb744aab34617bb766e746368d6f2de0 | [
"BSD-3-Clause"
] | 20 | 2021-04-08T16:38:49.000Z | 2022-02-09T20:05:57.000Z | hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py | maxpearl/hypha | e181ebadfb744aab34617bb766e746368d6f2de0 | [
"BSD-3-Clause"
] | 1,098 | 2017-12-15T11:23:03.000Z | 2020-01-24T07:58:07.000Z | hypha/apply/activity/migrations/0029_migrate_old_submission_relation.py | maxpearl/hypha | e181ebadfb744aab34617bb766e746368d6f2de0 | [
"BSD-3-Clause"
] | 17 | 2020-02-07T14:55:54.000Z | 2021-04-04T19:32:38.000Z | # Generated by Django 2.0.13 on 2019-07-10 17:33
from django.db import migrations
from django.db.models import F
def submission_to_source(apps, schema_editor):
Activity = apps.get_model('activity', 'Activity')
if Activity.objects.exists():
ContentType = apps.get_model('contenttypes', 'ContentType')
... | 31.441176 | 96 | 0.708138 |
from django.db import migrations
from django.db.models import F
def submission_to_source(apps, schema_editor):
Activity = apps.get_model('activity', 'Activity')
if Activity.objects.exists():
ContentType = apps.get_model('contenttypes', 'ContentType')
content_type = ContentType.objects.get(mod... | true | true |
1c487b221654ef04a5d3189bcad8709a2d896649 | 16,573 | py | Python | travis_debug_session.py | ascdso2020/ascdso-devops-python-tools | a5cfe0579f7c52ac861c92044b3d7215af0b8918 | [
"MIT"
] | null | null | null | travis_debug_session.py | ascdso2020/ascdso-devops-python-tools | a5cfe0579f7c52ac861c92044b3d7215af0b8918 | [
"MIT"
] | null | null | null | travis_debug_session.py | ascdso2020/ascdso-devops-python-tools | a5cfe0579f7c52ac861c92044b3d7215af0b8918 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2016-08-10 18:18:03 +0100 (Wed, 10 Aug 2016)
#
# https://github.com/HariSekhon/DevOps-Python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn
# and ... | 46.816384 | 120 | 0.612442 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import re
import sys
import time
import traceback
import git
try:
import requests
except ImportError:
print(traceback.format_exc(), end='')
sys.exit(4)
srcdir ... | true | true |
1c487c37c3fcbb9af30f2325f91729c3ffc8cac4 | 286 | py | Python | tests/_support/docstrings.py | uttamrc/invoke | 61a580fc9919700305411e492f6fbfee7f4912dc | [
"BSD-2-Clause"
] | 3,187 | 2015-01-02T13:41:50.000Z | 2022-03-28T19:22:49.000Z | tests/_support/docstrings.py | uttamrc/invoke | 61a580fc9919700305411e492f6fbfee7f4912dc | [
"BSD-2-Clause"
] | 648 | 2015-01-02T23:13:21.000Z | 2022-03-30T23:32:13.000Z | tests/_support/docstrings.py | uttamrc/invoke | 61a580fc9919700305411e492f6fbfee7f4912dc | [
"BSD-2-Clause"
] | 347 | 2015-01-03T23:04:05.000Z | 2022-03-25T17:35:24.000Z | from invoke import task
@task
def no_docstring(c):
pass
@task
def one_line(c):
"""foo
"""
@task
def two_lines(c):
"""foo
bar
"""
@task
def leading_whitespace(c):
"""
foo
"""
@task(aliases=("a", "b"))
def with_aliases(c):
"""foo
"""
| 8.666667 | 26 | 0.513986 | from invoke import task
@task
def no_docstring(c):
pass
@task
def one_line(c):
@task
def two_lines(c):
@task
def leading_whitespace(c):
@task(aliases=("a", "b"))
def with_aliases(c):
| true | true |
1c487c83405b4cc960c8239970d09f8563952a6b | 2,233 | py | Python | Cura/Cura/plugins/PreviewStage/PreviewStage.py | TIAO-JI-FU/3d-printing-with-moveo-1 | 100ecfd1208fe1890f8bada946145d716b2298eb | [
"MIT"
] | null | null | null | Cura/Cura/plugins/PreviewStage/PreviewStage.py | TIAO-JI-FU/3d-printing-with-moveo-1 | 100ecfd1208fe1890f8bada946145d716b2298eb | [
"MIT"
] | null | null | null | Cura/Cura/plugins/PreviewStage/PreviewStage.py | TIAO-JI-FU/3d-printing-with-moveo-1 | 100ecfd1208fe1890f8bada946145d716b2298eb | [
"MIT"
] | null | null | null | # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os.path
from UM.Qt.QtApplication import QtApplication
from cura.Stages.CuraStage import CuraStage
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from UM.View.View import View
## Displays a pre... | 42.942308 | 103 | 0.717868 |
import os.path
from UM.Qt.QtApplication import QtApplication
from cura.Stages.CuraStage import CuraStage
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from UM.View.View import View
#
# The Python component of this stage just loads PreviewMain.qml for display
# when the stage is selected, an... | true | true |
1c487dc61b9ee3171cbff46d329fc9b97936f78e | 386 | py | Python | profiles_api/urls.py | doglzz0806/profiles-rest-api | 11f9ee0ee6e278570b1edab30e27d0a41382ffca | [
"MIT"
] | 1 | 2021-03-17T00:21:20.000Z | 2021-03-17T00:21:20.000Z | profiles_api/urls.py | doglzz0806/profiles-rest-api | 11f9ee0ee6e278570b1edab30e27d0a41382ffca | [
"MIT"
] | null | null | null | profiles_api/urls.py | doglzz0806/profiles-rest-api | 11f9ee0ee6e278570b1edab30e27d0a41382ffca | [
"MIT"
] | null | null | null | from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
router.register('profile', views.UserProfileViewSet)
urlpatterns = [
path('hello-view/',vi... | 27.571429 | 79 | 0.772021 | from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
router.register('profile', views.UserProfileViewSet)
urlpatterns = [
path('hello-view/',vi... | true | true |
1c487e4f6dde2b90b006bc713d842ceeb8176a70 | 4,484 | py | Python | aiotruenas_client/websockets/jail.py | colemamd/aiotruenas-client | 26f754fcceadbacbfc87a19465d5a8d035e4bd00 | [
"MIT"
] | 11 | 2020-12-30T00:33:01.000Z | 2022-01-25T07:56:55.000Z | aiotruenas_client/websockets/jail.py | colemamd/aiotruenas-client | 26f754fcceadbacbfc87a19465d5a8d035e4bd00 | [
"MIT"
] | 35 | 2020-09-29T07:45:49.000Z | 2022-03-29T15:02:52.000Z | aiotruenas_client/websockets/jail.py | colemamd/aiotruenas-client | 26f754fcceadbacbfc87a19465d5a8d035e4bd00 | [
"MIT"
] | 3 | 2020-12-30T18:19:03.000Z | 2021-09-18T17:32:22.000Z | from __future__ import annotations
from typing import Any, Dict, List
from ..jail import Jail, JailStatus
from .interfaces import StateFetcher, WebsocketMachine
class CachingJail(Jail):
def __init__(self, fetcher: CachingJailStateFetcher, name: str) -> None:
super().__init__(name=name)
self._fet... | 34.75969 | 88 | 0.615076 | from __future__ import annotations
from typing import Any, Dict, List
from ..jail import Jail, JailStatus
from .interfaces import StateFetcher, WebsocketMachine
class CachingJail(Jail):
def __init__(self, fetcher: CachingJailStateFetcher, name: str) -> None:
super().__init__(name=name)
self._fet... | true | true |
1c4880339b3def518db0fff6ca51864258ccf0db | 1,059 | py | Python | cari-pakar web/caripakar_app/migrations/0020_auto_20180706_0736.py | eightfold28/Expert-Finding | 09ebbad9162eb4c3481eb98d5f6a47e37820be6f | [
"MIT"
] | null | null | null | cari-pakar web/caripakar_app/migrations/0020_auto_20180706_0736.py | eightfold28/Expert-Finding | 09ebbad9162eb4c3481eb98d5f6a47e37820be6f | [
"MIT"
] | 5 | 2021-03-31T19:02:32.000Z | 2022-03-02T14:56:02.000Z | cari-pakar web/caripakar_app/migrations/0020_auto_20180706_0736.py | eightfold28/Expert-Finding | 09ebbad9162eb4c3481eb98d5f6a47e37820be6f | [
"MIT"
] | null | null | null | # Generated by Django 2.0.6 on 2018-07-06 07:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('caripakar_app', '0019_auto_20180705_2120'),
]
operations = [
migrations.AlterField(
model_name='dosenskor',
name='sk... | 27.153846 | 53 | 0.570349 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('caripakar_app', '0019_auto_20180705_2120'),
]
operations = [
migrations.AlterField(
model_name='dosenskor',
name='skor_pendidikan',
field=models.FloatFi... | true | true |
1c4880371ff1c3a6905dd35eaf4f8627f756e035 | 205 | py | Python | tests/test_dummy.py | tyty999/py3startapp | 199766f7b7a96fd16cb04a58eb381946337b568f | [
"MIT"
] | 13 | 2018-10-10T03:31:13.000Z | 2022-03-27T22:44:37.000Z | tests/test_dummy.py | tyty999/py3startapp | 199766f7b7a96fd16cb04a58eb381946337b568f | [
"MIT"
] | 6 | 2019-11-16T17:11:27.000Z | 2021-05-30T12:33:11.000Z | tests/test_dummy.py | tyty999/py3startapp | 199766f7b7a96fd16cb04a58eb381946337b568f | [
"MIT"
] | 2 | 2020-10-02T07:01:12.000Z | 2021-08-06T08:21:31.000Z | import unittest
from app import dummy
class DummyTest(unittest.TestCase):
"""Replace this with a real unit test class."""
def test_dummy(self):
self.assertEqual('dummy', dummy.dummy())
| 18.636364 | 51 | 0.692683 | import unittest
from app import dummy
class DummyTest(unittest.TestCase):
def test_dummy(self):
self.assertEqual('dummy', dummy.dummy())
| true | true |
1c4880dea3d807aef22bc60eb07879ed3ad7d5c1 | 2,130 | py | Python | lib/node_modules/@stdlib/random/base/randu/benchmark/python/benchmark.py | andbmme/stdlib | c1994db25727c32cd0065cdc5f0c019dd4fc855c | [
"Apache-2.0"
] | 1 | 2020-03-02T15:44:24.000Z | 2020-03-02T15:44:24.000Z | lib/node_modules/@stdlib/random/base/randu/benchmark/python/benchmark.py | andbmme/stdlib | c1994db25727c32cd0065cdc5f0c019dd4fc855c | [
"Apache-2.0"
] | null | null | null | lib/node_modules/@stdlib/random/base/randu/benchmark/python/benchmark.py | andbmme/stdlib | c1994db25727c32cd0065cdc5f0c019dd4fc855c | [
"Apache-2.0"
] | 1 | 2020-11-23T03:46:24.000Z | 2020-11-23T03:46:24.000Z | #!/usr/bin/env python
#
# @license Apache-2.0
#
# Copyright (c) 2018 The Stdlib 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
#
# ... | 21.734694 | 74 | 0.635211 |
from __future__ import print_function
import timeit
NAME = "random"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
print("TAP version 13")
def print_summary(total, passing):
print("#")
print("1.." + str(total)) print("# total " + str(total))
print("# pass " + str(passing))
print(... | true | true |
1c48820a1288bf08c53464e11ff1f0382ae8b770 | 4,907 | py | Python | bilibili/data_extractor.py | DANancy/Web-Scraper-Starter | bfde0c67dd004bd065f084b57040ed644bfab2fd | [
"MIT"
] | 1 | 2020-04-26T05:27:55.000Z | 2020-04-26T05:27:55.000Z | bilibili/data_extractor.py | DANancy/Web-Scraper-Starter | bfde0c67dd004bd065f084b57040ed644bfab2fd | [
"MIT"
] | null | null | null | bilibili/data_extractor.py | DANancy/Web-Scraper-Starter | bfde0c67dd004bd065f084b57040ed644bfab2fd | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# load .env variables
import os
from dotenv import load_dotenv
from pathlib import Path
# load libs
import sys
import time
import random
from datetime import datetime
import re
import requests
from pymongo import MongoClient
# load self-defined modules
import bilibili.... | 32.713333 | 139 | 0.567557 |
import os
from dotenv import load_dotenv
from pathlib import Path
import sys
import time
import random
from datetime import datetime
import re
import requests
from pymongo import MongoClient
import bilibili.helper as h
import proxy.proxy_manager as PM
def get_urls(starttime, endtime, h_dict, c_dict):
pageNum = ... | true | true |
1c48833ff1861f379326aee5c2cd912a1565f34c | 57,720 | py | Python | tools/lambda-gen/microGateway.py | brandonkgarner/CEDAR | 2fb1ac69d1b888214e03b7cd8e756a44cbb9cd2c | [
"MIT"
] | 2 | 2020-10-22T20:04:28.000Z | 2021-01-16T15:59:26.000Z | tools/lambda-gen/microGateway.py | brandonkgarner/CEDAR | 2fb1ac69d1b888214e03b7cd8e756a44cbb9cd2c | [
"MIT"
] | null | null | null | tools/lambda-gen/microGateway.py | brandonkgarner/CEDAR | 2fb1ac69d1b888214e03b7cd8e756a44cbb9cd2c | [
"MIT"
] | 1 | 2021-02-25T17:40:12.000Z | 2021-02-25T17:40:12.000Z | # This code is used to create Ansible files for deploying Lambda's
# all that is needed is a target Lambda, tests, and it will do the rest.
# finds associate roles and policies
# creates Ansible modules based on those policies and roles
# defines the Lambdas and creates them with tests
# finds api-gateways or other eve... | 45.09375 | 155 | 0.448943 | # all that is needed is a target Lambda, tests, and it will do the rest.
# finds associate roles and policies
# creates Ansible modules based on those policies and roles
# defines the Lambdas and creates them with tests
# finds api-gateways or other events
# if api found defines the security needed. creates modules for... | true | true |
1c4883629d9f8ead68e5a641c661b4fe1a8fcefa | 17,266 | py | Python | webrecorder/webrecorder/models/recording.py | awesome-archive/webrecorder | 51ff3adab2c383025984570ab916ca0f03f2c92e | [
"Apache-2.0"
] | null | null | null | webrecorder/webrecorder/models/recording.py | awesome-archive/webrecorder | 51ff3adab2c383025984570ab916ca0f03f2c92e | [
"Apache-2.0"
] | null | null | null | webrecorder/webrecorder/models/recording.py | awesome-archive/webrecorder | 51ff3adab2c383025984570ab916ca0f03f2c92e | [
"Apache-2.0"
] | null | null | null | import json
import hashlib
import os
import base64
import shutil
from six.moves.urllib.parse import urlsplit
from pywb.utils.canonicalize import calc_search_range
from pywb.warcserver.index.cdxobject import CDXObject
from pywb.utils.loaders import BlockLoader
from webrecorder.utils import redis_pipeline
from webrec... | 31.856089 | 99 | 0.618788 | import json
import hashlib
import os
import base64
import shutil
from six.moves.urllib.parse import urlsplit
from pywb.utils.canonicalize import calc_search_range
from pywb.warcserver.index.cdxobject import CDXObject
from pywb.utils.loaders import BlockLoader
from webrecorder.utils import redis_pipeline
from webrec... | true | true |
1c488389c60c45a3e89c0d110cc34e9ff1cf71ed | 1,792 | py | Python | app/auth/forms.py | benzhang13/microblog | c5bfea71c9832e67bfb585ac90268b2cd651f5c8 | [
"MIT"
] | null | null | null | app/auth/forms.py | benzhang13/microblog | c5bfea71c9832e67bfb585ac90268b2cd651f5c8 | [
"MIT"
] | 1 | 2021-06-02T00:00:55.000Z | 2021-06-02T00:00:55.000Z | app/auth/forms.py | benzhang13/microblog | c5bfea71c9832e67bfb585ac90268b2cd651f5c8 | [
"MIT"
] | null | null | null | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, EqualTo, ValidationError, Email
from flask_babel import _, lazy_gettext as _l
from app.models import User
class LoginForm(FlaskForm):
username = StringField(_l('Us... | 43.707317 | 110 | 0.72154 | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import DataRequired, EqualTo, ValidationError, Email
from flask_babel import _, lazy_gettext as _l
from app.models import User
class LoginForm(FlaskForm):
username = StringField(_l('Us... | true | true |
1c4883c265a51d61f247b212020ad34acbb8f4fd | 3,740 | py | Python | src/neon_paths.py | Ritesh313/DeepTreeAttention | b1095831acdb98b84c7ea93ab529e519145c89ad | [
"MIT"
] | null | null | null | src/neon_paths.py | Ritesh313/DeepTreeAttention | b1095831acdb98b84c7ea93ab529e519145c89ad | [
"MIT"
] | null | null | null | src/neon_paths.py | Ritesh313/DeepTreeAttention | b1095831acdb98b84c7ea93ab529e519145c89ad | [
"MIT"
] | null | null | null | #Utility functions for searching for NEON schema data given a bound or filename. Optionally generating .tif files from .h5 hyperspec files.
import os
import math
import re
import h5py
from src import Hyperspectral
def bounds_to_geoindex(bounds):
"""Convert an extent into NEONs naming schema
Args:
bound... | 36.666667 | 139 | 0.669786 | import os
import math
import re
import h5py
from src import Hyperspectral
def bounds_to_geoindex(bounds):
easting = min(bounds[0], bounds[2])
northing = min(bounds[1], bounds[3])
easting = math.floor(easting / 1000) * 1000
northing = math.floor(northing / 1000) * 1000
geoindex = "{}_{}".format(ea... | true | true |
1c4884286d5cca9042d1e66e455a44b672e6671c | 2,340 | py | Python | tests/test_user_settings.py | fearsd/django-logging-middleware | 6eb95774c1bcb1829aa1a94223d9e2c39217d8f9 | [
"MIT"
] | 4 | 2021-04-08T14:14:04.000Z | 2021-09-08T07:57:38.000Z | tests/test_user_settings.py | fearsd/django-logging-middleware | 6eb95774c1bcb1829aa1a94223d9e2c39217d8f9 | [
"MIT"
] | null | null | null | tests/test_user_settings.py | fearsd/django-logging-middleware | 6eb95774c1bcb1829aa1a94223d9e2c39217d8f9 | [
"MIT"
] | null | null | null | import pytest
from django.conf import settings as _settings
from django.test import override_settings
from logging_middleware.settings import DEFAULTS, Settings
@override_settings(DJANGO_LOGGING_MIDDLEWARE={})
def test_check_settings_if_user_didnt_set_settings():
settings = Settings(_settings)
assert settings... | 48.75 | 102 | 0.814103 | import pytest
from django.conf import settings as _settings
from django.test import override_settings
from logging_middleware.settings import DEFAULTS, Settings
@override_settings(DJANGO_LOGGING_MIDDLEWARE={})
def test_check_settings_if_user_didnt_set_settings():
settings = Settings(_settings)
assert settings... | true | true |
1c488578f4656560111adedec4ff3808053e0d81 | 6,143 | py | Python | nemo/collections/nlp/data/datasets/joint_intent_slot_dataset/joint_intent_slot_descriptor.py | Dannynis/NeMo | 0d703d2c48158ec271d84cca76c3f423195327b2 | [
"Apache-2.0"
] | null | null | null | nemo/collections/nlp/data/datasets/joint_intent_slot_dataset/joint_intent_slot_descriptor.py | Dannynis/NeMo | 0d703d2c48158ec271d84cca76c3f423195327b2 | [
"Apache-2.0"
] | null | null | null | nemo/collections/nlp/data/datasets/joint_intent_slot_dataset/joint_intent_slot_descriptor.py | Dannynis/NeMo | 0d703d2c48158ec271d84cca76c3f423195327b2 | [
"Apache-2.0"
] | null | null | null | # =============================================================================
# Copyright 2020 NVIDIA. 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://ww... | 44.194245 | 113 | 0.621195 |
import itertools
from nemo import logging
from nemo.collections.nlp.data.datasets.datasets_utils import calc_class_weights, get_label_stats, if_exist
__all__ = ['JointIntentSlotDataDesc']
class JointIntentSlotDataDesc:
def __init__(self, data_dir, none_slot_label='O', pad_label=-1):
if not if_exist(da... | true | true |
1c4886295743926485b008c1564437e2c3341689 | 4,556 | py | Python | five_chess_game/five.py | richard-ma/weekendProject | 43379bc8a2854132f52e5fc007ef7c721b0e7f4e | [
"MIT"
] | null | null | null | five_chess_game/five.py | richard-ma/weekendProject | 43379bc8a2854132f52e5fc007ef7c721b0e7f4e | [
"MIT"
] | null | null | null | five_chess_game/five.py | richard-ma/weekendProject | 43379bc8a2854132f52e5fc007ef7c721b0e7f4e | [
"MIT"
] | null | null | null | # Create by Ricky
from tkinter import *
# 用数组定义一个棋盘,棋盘大小为 自定义
# 数组索引代表位置,
# 元素值代表该位置的状态:-1代表没有棋子,0代表有黑棋,1代表有白棋。
def callback(event):
global tag, tagx, tagy, a
color = ["black", "white"]
# 将点击位置转换为棋盘坐标(第几格)
x = round(event.x / mesh) - 1
y = round(event.y / mesh) - 1
# 计算点击位置与棋盘坐标的... | 36.15873 | 111 | 0.490342 | from tkinter import *
def callback(event):
global tag, tagx, tagy, a
color = ["black", "white"]
x = round(event.x / mesh) - 1
y = round(event.y / mesh) - 1
errorX = mesh * (x + 1) - event.x
errorY = mesh * (y + 1) - event.y
dis = (errorX ** 2 + errorY ** 2) ** 0.5 ... | true | true |
1c48862fc9b77064b6c1d653315072c6ffd5acd3 | 1,176 | py | Python | tools/nntool/importer/tflite/tflite_schema_head/SplitVOptions.py | danieldennett/gap_sdk | 5667c899025a3a152dbf91e5c18e5b3e422d4ea6 | [
"Apache-2.0"
] | 1 | 2020-01-29T15:39:31.000Z | 2020-01-29T15:39:31.000Z | tools/nntool/importer/tflite/tflite_schema_head/SplitVOptions.py | danieldennett/gap_sdk | 5667c899025a3a152dbf91e5c18e5b3e422d4ea6 | [
"Apache-2.0"
] | null | null | null | tools/nntool/importer/tflite/tflite_schema_head/SplitVOptions.py | danieldennett/gap_sdk | 5667c899025a3a152dbf91e5c18e5b3e422d4ea6 | [
"Apache-2.0"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite_schema_head
import flatbuffers
class SplitVOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsSplitVOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)... | 33.6 | 114 | 0.713435 |
import flatbuffers
class SplitVOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsSplitVOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = SplitVOptions()
x.Init(buf, n + offset)
return x
@classmethod
d... | true | true |
1c488633cadf893d188e25b37e09bbb17d11d9ba | 2,033 | py | Python | common.py | mtonxbjss/bucket-antivirus-function | 5a4c96329d420d2c0754d566f53370249c89b64a | [
"Apache-2.0"
] | null | null | null | common.py | mtonxbjss/bucket-antivirus-function | 5a4c96329d420d2c0754d566f53370249c89b64a | [
"Apache-2.0"
] | null | null | null | common.py | mtonxbjss/bucket-antivirus-function | 5a4c96329d420d2c0754d566f53370249c89b64a | [
"Apache-2.0"
] | null | null | null | # Upside Travel, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | 40.66 | 89 | 0.749631 |
import boto3
import errno
import os
AV_DEFINITION_S3_BUCKET = os.getenv("AV_DEFINITION_S3_BUCKET")
AV_DEFINITION_S3_PREFIX = os.getenv("AV_DEFINITION_S3_PREFIX", "clamav_defs")
AV_DEFINITION_PATH = os.getenv("AV_DEFINITION_PATH", "/tmp/clamav_defs")
AV_SCAN_START_SNS_ARN = os.getenv("AV_SCAN_START_SNS_ARN")
AV_SCAN_S... | true | true |
1c48866e70ed37e9e61b13ba25081074ce52cbf5 | 364 | py | Python | synth.py | anguillanneuf/sloth | 5b1aaec81e1074f523d77c3d9b82097aa853910b | [
"Apache-2.0"
] | null | null | null | synth.py | anguillanneuf/sloth | 5b1aaec81e1074f523d77c3d9b82097aa853910b | [
"Apache-2.0"
] | null | null | null | synth.py | anguillanneuf/sloth | 5b1aaec81e1074f523d77c3d9b82097aa853910b | [
"Apache-2.0"
] | null | null | null | import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.node as node
import logging
logging.basicConfig(level=logging.DEBUG)
AUTOSYNTH_MULTIPLE_COMMITS = True
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates, excludes=["README.md", ".github/wor... | 26 | 70 | 0.804945 | import synthtool as s
import synthtool.gcp as gcp
import synthtool.languages.node as node
import logging
logging.basicConfig(level=logging.DEBUG)
AUTOSYNTH_MULTIPLE_COMMITS = True
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library()
s.copy(templates, excludes=["README.md", ".github/wor... | true | true |
1c4886b81dc852c6d976f50f05da92a184e83d41 | 1,813 | py | Python | storage_formats/apache_parquet/python/fastparquet_test/fastparquet_test.py | statisticsnorway/microdata-testing | 3b14a2f6f08791a666c659bbdc9cdf9d41a4c23d | [
"Apache-2.0"
] | null | null | null | storage_formats/apache_parquet/python/fastparquet_test/fastparquet_test.py | statisticsnorway/microdata-testing | 3b14a2f6f08791a666c659bbdc9cdf9d41a4c23d | [
"Apache-2.0"
] | null | null | null | storage_formats/apache_parquet/python/fastparquet_test/fastparquet_test.py | statisticsnorway/microdata-testing | 3b14a2f6f08791a666c659bbdc9cdf9d41a4c23d | [
"Apache-2.0"
] | null | null | null | import os
import sys
from time import time
from fastparquet import ParquetFile
from fastparquet import write
from fastparquet.parquet_thrift.parquet.ttypes import RowGroup
from timer import timeblock
def run_test(input_file: str, output_dir: str, filters: list):
print('Using fastparquet')
pf = ParquetFile(i... | 39.413043 | 114 | 0.678434 | import os
import sys
from time import time
from fastparquet import ParquetFile
from fastparquet import write
from fastparquet.parquet_thrift.parquet.ttypes import RowGroup
from timer import timeblock
def run_test(input_file: str, output_dir: str, filters: list):
print('Using fastparquet')
pf = ParquetFile(i... | true | true |
1c48882c69189e1136485f2dbf88602c9088f55f | 6,642 | py | Python | pull_vegas_slot_machine_v9.py | weaselers/candy_cane_contest | 1d619529cd8640c20b534ec9a3f6d5f786bb78aa | [
"BSD-3-Clause"
] | null | null | null | pull_vegas_slot_machine_v9.py | weaselers/candy_cane_contest | 1d619529cd8640c20b534ec9a3f6d5f786bb78aa | [
"BSD-3-Clause"
] | null | null | null | pull_vegas_slot_machine_v9.py | weaselers/candy_cane_contest | 1d619529cd8640c20b534ec9a3f6d5f786bb78aa | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
import pandas as pd
import random, os, datetime, math
from random import shuffle
from collections import OrderedDict
from collections import defaultdict
total_reward = 0
bandit_dict = {}
def set_seed(my_seed=42):
os.environ["PYTHONHASHSEED"] = str(my_seed)
random.seed(my_seed)
np.rand... | 34.061538 | 95 | 0.552695 | import numpy as np
import pandas as pd
import random, os, datetime, math
from random import shuffle
from collections import OrderedDict
from collections import defaultdict
total_reward = 0
bandit_dict = {}
def set_seed(my_seed=42):
os.environ["PYTHONHASHSEED"] = str(my_seed)
random.seed(my_seed)
np.rand... | true | true |
1c4889fed63df332eb3bfa47a1614a45f7d74ea9 | 377 | py | Python | smoke_long_only.py | axey733/pylivetrader | a33ddd3bbf2fe6e57d016e98c77d84c39401f9ec | [
"Apache-2.0"
] | null | null | null | smoke_long_only.py | axey733/pylivetrader | a33ddd3bbf2fe6e57d016e98c77d84c39401f9ec | [
"Apache-2.0"
] | null | null | null | smoke_long_only.py | axey733/pylivetrader | a33ddd3bbf2fe6e57d016e98c77d84c39401f9ec | [
"Apache-2.0"
] | null | null | null | import long_only as algo
from pylivetrader.testing.smoke import harness
def test_algo():
pipe = harness.DefaultPipelineHooker()
harness.run_smoke(algo,
pipeline_hook=pipe,
)
if __name__ == '__main__':
import sys
from logbook import StreamHandler
Strea... | 19.842105 | 48 | 0.655172 | import long_only as algo
from pylivetrader.testing.smoke import harness
def test_algo():
pipe = harness.DefaultPipelineHooker()
harness.run_smoke(algo,
pipeline_hook=pipe,
)
if __name__ == '__main__':
import sys
from logbook import StreamHandler
Strea... | true | true |
1c488b64db5fd0207e4b64efdc4fa1da6d8f39d4 | 8,957 | py | Python | pymanopt/solvers/conjugate_gradient.py | antoinecollas/pymanopt | 8586302c80aa5885f91b094bed85b6ffe849a5bf | [
"BSD-3-Clause"
] | 1 | 2021-02-09T10:24:15.000Z | 2021-02-09T10:24:15.000Z | pymanopt/solvers/conjugate_gradient.py | antoinecollas/pymanopt | 8586302c80aa5885f91b094bed85b6ffe849a5bf | [
"BSD-3-Clause"
] | null | null | null | pymanopt/solvers/conjugate_gradient.py | antoinecollas/pymanopt | 8586302c80aa5885f91b094bed85b6ffe849a5bf | [
"BSD-3-Clause"
] | 1 | 2021-04-30T08:49:02.000Z | 2021-04-30T08:49:02.000Z | import time
from copy import deepcopy
import numpy as np
from pymanopt import tools
from pymanopt.solvers.linesearch import LineSearchAdaptive
from pymanopt.solvers.solver import Solver
# TODO: Use Python's enum module.
BetaTypes = tools.make_enum(
"BetaTypes",
"FletcherReeves PolakRibiere HestenesStiefel H... | 40.165919 | 78 | 0.54449 | import time
from copy import deepcopy
import numpy as np
from pymanopt import tools
from pymanopt.solvers.linesearch import LineSearchAdaptive
from pymanopt.solvers.solver import Solver
BetaTypes = tools.make_enum(
"BetaTypes",
"FletcherReeves PolakRibiere HestenesStiefel HagerZhang".split())
class Conjug... | true | true |
1c488bf03fa2dc3897aa74a2e2eaf075900ba316 | 724 | py | Python | tools/vig_focus_dist.py | jtniehof/photo | 313c6f5d450404a3f402a2646526abf55a4920b7 | [
"CC0-1.0"
] | null | null | null | tools/vig_focus_dist.py | jtniehof/photo | 313c6f5d450404a3f402a2646526abf55a4920b7 | [
"CC0-1.0"
] | null | null | null | tools/vig_focus_dist.py | jtniehof/photo | 313c6f5d450404a3f402a2646526abf55a4920b7 | [
"CC0-1.0"
] | null | null | null | #!/usr/bin/env python
"""Sort vignetting images by focal distance"""
import glob
import os
import os.path
import subprocess
for f in sorted(list(glob.glob('*.CR2'))):
exiv2_process = subprocess.Popen(
["exiv2", "-PEkt", "-g", "Exif.CanonFi.FocusDistanceUpper", "-g", "Exif.CanonFi.FocusDistanceLower", f],... | 28.96 | 136 | 0.632597 |
import glob
import os
import os.path
import subprocess
for f in sorted(list(glob.glob('*.CR2'))):
exiv2_process = subprocess.Popen(
["exiv2", "-PEkt", "-g", "Exif.CanonFi.FocusDistanceUpper", "-g", "Exif.CanonFi.FocusDistanceLower", f], stdout=subprocess.PIPE)
lines = exiv2_process.communicate()[0].s... | true | true |
1c488c509a425b91566922bd03cb5f216b1c1b6b | 30,847 | py | Python | netharn/initializers/functional.py | Erotemic/netharn | bc4a6d75445c949e709e5ab903ba72813ec68b79 | [
"Apache-2.0"
] | 38 | 2018-06-18T07:47:31.000Z | 2021-10-31T23:18:58.000Z | netharn/initializers/functional.py | Erotemic/netharn | bc4a6d75445c949e709e5ab903ba72813ec68b79 | [
"Apache-2.0"
] | 10 | 2018-06-08T01:21:58.000Z | 2020-01-11T02:13:36.000Z | netharn/initializers/functional.py | Erotemic/netharn | bc4a6d75445c949e709e5ab903ba72813ec68b79 | [
"Apache-2.0"
] | 6 | 2018-04-17T22:06:02.000Z | 2019-12-13T03:04:53.000Z | import numpy as np
import torch
import ubelt as ub
def trainable_layers(model, names=False):
"""
Returns all layers containing trainable parameters
Notes:
It may be better to simply use model.named_parameters() instead in most
situation. This is useful when you need the classes that conta... | 42.372253 | 152 | 0.555224 | import numpy as np
import torch
import ubelt as ub
def trainable_layers(model, names=False):
if names:
stack = [('', '', model)]
while stack:
prefix, basename, item = stack.pop()
name = '.'.join([p for p in [prefix, basename] if p])
if isinstance(item, torch.nn.... | true | true |
1c488c990f526cb757a984ce2af68fd635fd0898 | 30,002 | py | Python | popcorn_gallery/popcorn/tests/integration_tests.py | Koenkk/popcorn_maker | 0978b9f98dacd4e8eb753404b24eb584f410aa11 | [
"BSD-3-Clause"
] | 15 | 2015-03-23T02:55:20.000Z | 2021-01-12T12:42:30.000Z | popcorn_gallery/popcorn/tests/integration_tests.py | Koenkk/popcorn_maker | 0978b9f98dacd4e8eb753404b24eb584f410aa11 | [
"BSD-3-Clause"
] | null | null | null | popcorn_gallery/popcorn/tests/integration_tests.py | Koenkk/popcorn_maker | 0978b9f98dacd4e8eb753404b24eb584f410aa11 | [
"BSD-3-Clause"
] | 16 | 2015-02-18T21:43:31.000Z | 2021-11-09T22:50:03.000Z | from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
from django_extensions.db.fields import json
from funfactory.middleware import LocaleURLMiddleware
from test_utils import TestCase
from mock import patch
from nose.tools import ok_, eq_
from .fixtures... | 39.632761 | 80 | 0.665822 | from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
from django_extensions.db.fields import json
from funfactory.middleware import LocaleURLMiddleware
from test_utils import TestCase
from mock import patch
from nose.tools import ok_, eq_
from .fixtures... | true | true |
1c488e2c187ea0a6436843c1c848f0714d8fb4c7 | 3,137 | py | Python | blackbox/mixins.py | kosayoda/blackbox | 6c3d85fb916a05273d7a2f8d9add65340fcc52b2 | [
"MIT"
] | null | null | null | blackbox/mixins.py | kosayoda/blackbox | 6c3d85fb916a05273d7a2f8d9add65340fcc52b2 | [
"MIT"
] | null | null | null | blackbox/mixins.py | kosayoda/blackbox | 6c3d85fb916a05273d7a2f8d9add65340fcc52b2 | [
"MIT"
] | null | null | null | import re
from itertools import chain
from typing import Optional
from blackbox.config import Blackbox
from blackbox.exceptions import ImproperlyConfigured
PARAMS_REGEX = r"(?:\?|&|;)([^=]+)=([^&|;]+)"
class ConnstringParserMixin:
"""A mixin class for handlers that depend on connstrings."""
# How will the ... | 33.021053 | 96 | 0.611093 | import re
from itertools import chain
from typing import Optional
from blackbox.config import Blackbox
from blackbox.exceptions import ImproperlyConfigured
PARAMS_REGEX = r"(?:\?|&|;)([^=]+)=([^&|;]+)"
class ConnstringParserMixin:
connstring_regex = r""
valid_prefixes = []
def __init__(self):... | true | true |
1c488f912f74fdb0e0dfff57d4935598a701f341 | 1,613 | py | Python | nipype/interfaces/slicer/diffusion/tests/test_auto_DWIRicianLMMSEFilter.py | PAmcconnell/nipype | 39fbd5411a844ce7c023964d3295eb7643b95af5 | [
"Apache-2.0"
] | null | null | null | nipype/interfaces/slicer/diffusion/tests/test_auto_DWIRicianLMMSEFilter.py | PAmcconnell/nipype | 39fbd5411a844ce7c023964d3295eb7643b95af5 | [
"Apache-2.0"
] | 2 | 2018-04-26T12:09:32.000Z | 2018-04-27T06:36:49.000Z | nipype/interfaces/slicer/diffusion/tests/test_auto_DWIRicianLMMSEFilter.py | PAmcconnell/nipype | 39fbd5411a844ce7c023964d3295eb7643b95af5 | [
"Apache-2.0"
] | 1 | 2019-11-14T14:16:57.000Z | 2019-11-14T14:16:57.000Z | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..diffusion import DWIRicianLMMSEFilter
def test_DWIRicianLMMSEFilter_inputs():
input_map = dict(
args=dict(argstr='%s', ),
compressOutput=dict(argstr='--compressOutput ', ),
environ=dict(
nohash=True,
usede... | 29.87037 | 67 | 0.536268 | from ..diffusion import DWIRicianLMMSEFilter
def test_DWIRicianLMMSEFilter_inputs():
input_map = dict(
args=dict(argstr='%s', ),
compressOutput=dict(argstr='--compressOutput ', ),
environ=dict(
nohash=True,
usedefault=True,
),
hrf=dict(argstr='--hrf ... | true | true |
1c4890b97f1a232ff24ff19737f4a56f3a253a7e | 1,801 | py | Python | src/python/grpcio_tests/tests/unit/_grpc_shutdown_test.py | mpminardi/grpc | ce9e6eeded3b9d4d7f17a5432bc79008929cb8b7 | [
"Apache-2.0"
] | 9 | 2020-12-04T07:34:08.000Z | 2022-03-07T21:10:35.000Z | src/python/grpcio_tests/tests/unit/_grpc_shutdown_test.py | mpminardi/grpc | ce9e6eeded3b9d4d7f17a5432bc79008929cb8b7 | [
"Apache-2.0"
] | 62 | 2020-02-27T00:53:36.000Z | 2021-02-05T06:10:53.000Z | src/python/grpcio_tests/tests/unit/_grpc_shutdown_test.py | mpminardi/grpc | ce9e6eeded3b9d4d7f17a5432bc79008929cb8b7 | [
"Apache-2.0"
] | 12 | 2020-07-14T23:59:57.000Z | 2022-03-22T09:59:18.000Z | # Copyright 2019 The gRPC 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 applicable law or agreed to in writ... | 32.745455 | 79 | 0.704053 |
import time
import threading
import unittest
import datetime
import grpc
_TIMEOUT_FOR_SEGFAULT = datetime.timedelta(seconds=10)
class GrpcShutdownTest(unittest.TestCase):
def test_channel_close_with_connectivity_watcher(self):
connection_failed = threading.Event()
def on_state_change(state):
... | true | true |
1c489148634f4f40e71c6fc0526e789a306304a1 | 10,199 | py | Python | tools/test.py | nytbliang/siamattnat | 880643ee09e7e4fa6a0af9631a9a8b32dd06c94d | [
"Apache-2.0"
] | null | null | null | tools/test.py | nytbliang/siamattnat | 880643ee09e7e4fa6a0af9631a9a8b32dd06c94d | [
"Apache-2.0"
] | null | null | null | tools/test.py | nytbliang/siamattnat | 880643ee09e7e4fa6a0af9631a9a8b32dd06c94d | [
"Apache-2.0"
] | null | null | null | # Copyright (c) SenseTime. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
import cv2
import torch
import numpy as np
from pysot.core.config import cfg
from pysot.model... | 44.732456 | 109 | 0.494656 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
import cv2
import torch
import numpy as np
from pysot.core.config import cfg
from pysot.models.model_builder import ModelBuilder
from pysot.t... | true | true |
1c4891605978f91a0f6833c19339ea41dd791d27 | 644 | py | Python | txdav/carddav/__init__.py | backwardn/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | [
"Apache-2.0"
] | 462 | 2016-08-14T17:43:24.000Z | 2022-03-17T07:38:16.000Z | txdav/carddav/__init__.py | backwardn/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | [
"Apache-2.0"
] | 72 | 2016-09-01T23:19:35.000Z | 2020-02-05T02:09:26.000Z | txdav/carddav/__init__.py | backwardn/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | [
"Apache-2.0"
] | 171 | 2016-08-16T03:50:30.000Z | 2022-03-26T11:49:55.000Z | ##
# Copyright (c) 2010-2017 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 32.2 | 74 | 0.75 | true | true | |
1c4891769e7f37cc62e27529f9c065eea2bc5e76 | 10,685 | py | Python | nums/core/linalg.py | gohar94/nums | 2d8b0d7dd7b48c5b56641d4f03279b5ce2185db5 | [
"Apache-2.0"
] | 111 | 2020-06-16T02:52:11.000Z | 2022-03-29T10:24:19.000Z | nums/core/linalg.py | gohar94/nums | 2d8b0d7dd7b48c5b56641d4f03279b5ce2185db5 | [
"Apache-2.0"
] | 160 | 2020-10-07T21:49:36.000Z | 2022-03-11T03:06:23.000Z | nums/core/linalg.py | gohar94/nums | 2d8b0d7dd7b48c5b56641d4f03279b5ce2185db5 | [
"Apache-2.0"
] | 25 | 2020-11-11T17:10:26.000Z | 2022-03-07T23:17:16.000Z | # coding=utf-8
# Copyright (C) 2020 NumS Development Team.
#
# 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... | 32.675841 | 96 | 0.604118 |
import numpy as np
from nums.core.array.application import ArrayApplication
from nums.core.array.blockarray import BlockArray
from nums.core.grid.grid import ArrayGrid
def qr(app: ArrayApplication, X: BlockArray):
return indirect_tsqr(app, X)
def _qr_tree_reduce(
app: ArrayApplication, oid_list, result_g... | true | true |
1c489265a54907a8c20c316d809f6627620e1fb5 | 443 | py | Python | app/core/migrations/0007_recipe_image.py | JamesGitauM/Recipe_app_API | 92e89e32a940bd936e330f859c90725298a5b75a | [
"MIT"
] | null | null | null | app/core/migrations/0007_recipe_image.py | JamesGitauM/Recipe_app_API | 92e89e32a940bd936e330f859c90725298a5b75a | [
"MIT"
] | null | null | null | app/core/migrations/0007_recipe_image.py | JamesGitauM/Recipe_app_API | 92e89e32a940bd936e330f859c90725298a5b75a | [
"MIT"
] | null | null | null | # Generated by Django 2.1.15 on 2020-08-08 06:54
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20200729_1906'),
]
operations = [
migrations.AddField(
model_name='recipe',
na... | 22.15 | 93 | 0.632054 |
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_auto_20200729_1906'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='image',
field=models.ImageField(n... | true | true |
1c489286238ff8d4a3501a9b5c36cc2ee0539d3e | 298 | py | Python | cerberus_collections/error_handlers/__init__.py | funkyfuture/cerberuse-collections | b6d5c9035e02375fb933c1077221659d483db348 | [
"ISC"
] | 2 | 2017-08-04T15:01:28.000Z | 2020-05-15T11:40:25.000Z | cerberus_collections/error_handlers/__init__.py | funkyfuture/cerberuse-collections | b6d5c9035e02375fb933c1077221659d483db348 | [
"ISC"
] | 5 | 2016-09-03T15:25:00.000Z | 2020-08-31T19:00:44.000Z | cerberus_collections/error_handlers/__init__.py | funkyfuture/cerberuse-collections | b6d5c9035e02375fb933c1077221659d483db348 | [
"ISC"
] | 1 | 2020-01-03T09:37:13.000Z | 2020-01-03T09:37:13.000Z | __all__ = []
from cerberus_collections.error_handlers.json import JSONErrorHandler # noqa: E402
__all__.append(JSONErrorHandler.__name__)
try:
from cerberus_collections.error_handlers.xml import XMLErrorHandler
except ImportError:
pass
else:
__all__.append(XMLErrorHandler.__name__)
| 24.833333 | 83 | 0.812081 | __all__ = []
from cerberus_collections.error_handlers.json import JSONErrorHandler __all__.append(JSONErrorHandler.__name__)
try:
from cerberus_collections.error_handlers.xml import XMLErrorHandler
except ImportError:
pass
else:
__all__.append(XMLErrorHandler.__name__)
| true | true |
1c4892c606ebc7ea5b49dd47c53165b2c79830eb | 1,075 | py | Python | src/htsql/ctl/__init__.py | sirex/htsql | 52275f6a584b412c109822d2ed2a5e69ac522cdf | [
"Apache-2.0"
] | 15 | 2020-02-11T11:24:34.000Z | 2022-03-03T20:46:34.000Z | src/htsql/ctl/__init__.py | sirex/htsql | 52275f6a584b412c109822d2ed2a5e69ac522cdf | [
"Apache-2.0"
] | 1 | 2020-02-13T14:08:34.000Z | 2020-02-13T14:16:04.000Z | src/htsql/ctl/__init__.py | sirex/htsql | 52275f6a584b412c109822d2ed2a5e69ac522cdf | [
"Apache-2.0"
] | 2 | 2020-02-13T14:10:06.000Z | 2021-02-25T04:36:05.000Z | #
# Copyright (c) 2006-2013, Prometheus Research, LLC
#
"""
:mod:`htsql.ctl`
================
This package implements the ``htsql-ctl`` script.
"""
from ..core.util import trim_doc
from .script import Script
import sys
class HTSQL_CTL(Script):
"""
Implements the ``htsql-ctl`` script.
Usage::
... | 21.078431 | 71 | 0.63814 |
from ..core.util import trim_doc
from .script import Script
import sys
class HTSQL_CTL(Script):
routines_entry = 'htsql.routines'
hint = """HTSQL command-line administrative application"""
help = """
Run `%(executable)s help` for general usage and list of routines.
Run `%(executable)s help <ro... | true | true |
1c489424a60b57cec880a829a71ef82152679fe6 | 3,472 | py | Python | config/settings.py | yuyuyuhaoshi/Blog-BE | a485d5159076d619d4fd6019fe9b96ac04020d4d | [
"Apache-2.0"
] | null | null | null | config/settings.py | yuyuyuhaoshi/Blog-BE | a485d5159076d619d4fd6019fe9b96ac04020d4d | [
"Apache-2.0"
] | null | null | null | config/settings.py | yuyuyuhaoshi/Blog-BE | a485d5159076d619d4fd6019fe9b96ac04020d4d | [
"Apache-2.0"
] | null | null | null | """
Django settings for blog project.
Generated by 'django-admin startproject' using Django 2.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... | 24.624113 | 91 | 0.693836 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '6v0ogpdc=oh5c%f)3rs)p5p=#0o0$ce+y4=6(4^yb&nx-u5s*t'
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes... | true | true |
1c48948f08f5d589c6b7f9f5aef0879980113db8 | 1,200 | py | Python | azure-mgmt-network/azure/mgmt/network/v2019_02_01/models/flow_log_format_parameters.py | xiafu-msft/azure-sdk-for-python | 4d9560cfd519ee60667f3cc2f5295a58c18625db | [
"MIT"
] | 1 | 2021-09-07T18:36:04.000Z | 2021-09-07T18:36:04.000Z | azure-mgmt-network/azure/mgmt/network/v2019_02_01/models/flow_log_format_parameters.py | xiafu-msft/azure-sdk-for-python | 4d9560cfd519ee60667f3cc2f5295a58c18625db | [
"MIT"
] | 2 | 2019-10-02T23:37:38.000Z | 2020-10-02T01:17:31.000Z | azure-mgmt-network/azure/mgmt/network/v2019_02_01/models/flow_log_format_parameters.py | xiafu-msft/azure-sdk-for-python | 4d9560cfd519ee60667f3cc2f5295a58c18625db | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 35.294118 | 78 | 0.5925 |
from msrest.serialization import Model
class FlowLogFormatParameters(Model):
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'version': {'key': 'version', 'type': 'int'},
}
def __init__(self, **kwargs):
super(FlowLogFormatParameters, self).__init__(**kwargs)
s... | true | true |
1c4894e574deda4b9d4ac0a8390574ca9c03dcf1 | 1,846 | py | Python | spanner_orm/admin/migration.py | germanp173/python-spanner-orm | a5dd49efa173ab0f370a7a13ae3983c0216c4f2b | [
"Apache-2.0"
] | 2 | 2020-07-12T00:43:08.000Z | 2021-01-30T03:03:32.000Z | spanner_orm/admin/migration.py | germanp173/python-spanner-orm | a5dd49efa173ab0f370a7a13ae3983c0216c4f2b | [
"Apache-2.0"
] | 20 | 2020-07-20T21:55:52.000Z | 2021-02-03T21:53:00.000Z | spanner_orm/admin/migration.py | germanp173/python-spanner-orm | a5dd49efa173ab0f370a7a13ae3983c0216c4f2b | [
"Apache-2.0"
] | 3 | 2020-07-20T21:13:45.000Z | 2021-01-29T18:41:20.000Z | # python3
# Copyright 2019 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 agreed to in... | 29.774194 | 74 | 0.695016 |
from typing import Callable, Optional
from spanner_orm.admin import update
def no_update_callable() -> update.SchemaUpdate:
return update.NoUpdate()
class Migration:
def __init__(
self,
migration_id: str,
prev_migration_id: Optional[str],
description: str,
upgrade:... | true | true |
1c48959f90f37b6e83807d14a6e7d0a1088b8ed9 | 15,302 | py | Python | old_train.py | orashi/PaintsPytorch | 41cf321722a035101758c0717f082d71c12c6cf4 | [
"MIT"
] | 6 | 2017-10-24T06:04:57.000Z | 2020-01-20T07:22:14.000Z | old_train.py | RheaStrike/PaintsPytorch | 41cf321722a035101758c0717f082d71c12c6cf4 | [
"MIT"
] | null | null | null | old_train.py | RheaStrike/PaintsPytorch | 41cf321722a035101758c0717f082d71c12c6cf4 | [
"MIT"
] | 2 | 2018-08-05T05:12:16.000Z | 2019-05-19T20:10:23.000Z | import argparse
import random
import scipy.stats as stats
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torchvision.utils as vutils
from tensorboardX import SummaryWriter
from torch.autograd import grad
from data.proData import CreateDataLoader
from models.pro_model import *
parser = argpar... | 44.8739 | 116 | 0.603647 | import argparse
import random
import scipy.stats as stats
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torchvision.utils as vutils
from tensorboardX import SummaryWriter
from torch.autograd import grad
from data.proData import CreateDataLoader
from models.pro_model import *
parser = argpar... | true | true |
1c489617d9fd207bbe9807beb2752951bfbeeb6d | 6,096 | py | Python | measure/c2c.py | lanshanxunmeng/rce | 85cd8d2911a374df7f4185ff96c32155fc8f1644 | [
"Apache-2.0"
] | 13 | 2018-03-19T02:31:43.000Z | 2022-03-18T22:58:48.000Z | measure/c2c.py | lanshanxunmeng/rce | 85cd8d2911a374df7f4185ff96c32155fc8f1644 | [
"Apache-2.0"
] | 1 | 2019-02-19T03:58:10.000Z | 2020-07-15T10:01:03.000Z | measure/c2c.py | lanshanxunmeng/rce | 85cd8d2911a374df7f4185ff96c32155fc8f1644 | [
"Apache-2.0"
] | 14 | 2018-07-30T12:06:57.000Z | 2021-12-19T22:53:17.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# c2c.py
#
# This file is part of the RoboEarth Cloud Engine framework.
#
# This file was originally created for RoboEearth
# http://www.roboearth.org/
#
# The research leading to these results has received funding from
# the European Union Seventh... | 32.253968 | 80 | 0.577264 |
import json
from twisted.internet.defer import Deferred
from rce.client.connection import Connection
from base import PASSES, SIZES, delay, RemoteTest
class Measurement(object):
TAG = 'tester'
TYPES = ('service', 'topic')
def __init__(self, runs, conn, robot, reactor):
self._conn = conn
... | true | true |
1c4896d7129120c99558c87cc228086d7992affa | 343 | py | Python | taobao-tianmao/top/api/rest/LogisticsAddressSearchRequest.py | ScottLeeF/python-example | 0b230ba80fe5020d70329a9d73e058013f0ca111 | [
"Apache-2.0"
] | null | null | null | taobao-tianmao/top/api/rest/LogisticsAddressSearchRequest.py | ScottLeeF/python-example | 0b230ba80fe5020d70329a9d73e058013f0ca111 | [
"Apache-2.0"
] | 7 | 2021-03-19T02:12:42.000Z | 2022-03-12T00:25:28.000Z | taobao-tianmao/top/api/rest/LogisticsAddressSearchRequest.py | ScottLeeF/python-example | 0b230ba80fe5020d70329a9d73e058013f0ca111 | [
"Apache-2.0"
] | null | null | null | '''
Created by auto_sdk on 2018.07.26
'''
from top.api.base import RestApi
class LogisticsAddressSearchRequest(RestApi):
def __init__(self, domain='gw.api.taobao.com', port=80):
RestApi.__init__(self, domain, port)
self.rdef = None
def getapiname(self):
return 'taobao.logi... | 24.5 | 61 | 0.664723 | from top.api.base import RestApi
class LogisticsAddressSearchRequest(RestApi):
def __init__(self, domain='gw.api.taobao.com', port=80):
RestApi.__init__(self, domain, port)
self.rdef = None
def getapiname(self):
return 'taobao.logistics.address.search'
| true | true |
1c489710cf497c8388e0ab66f48d405937b4e014 | 3,316 | py | Python | direct/interval/IntervalManager.py | theclashingfritz/Cog-Invasion-Online-Dump | 2561abbacb3e2e288e06f3f04b935b5ed589c8f8 | [
"Apache-2.0"
] | 1 | 2020-03-12T16:44:10.000Z | 2020-03-12T16:44:10.000Z | direct/interval/IntervalManager.py | theclashingfritz/Cog-Invasion-Online-Dump | 2561abbacb3e2e288e06f3f04b935b5ed589c8f8 | [
"Apache-2.0"
] | null | null | null | direct/interval/IntervalManager.py | theclashingfritz/Cog-Invasion-Online-Dump | 2561abbacb3e2e288e06f3f04b935b5ed589c8f8 | [
"Apache-2.0"
] | null | null | null | # uncompyle6 version 3.2.4
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)]
# Embedded file name: direct.interval.IntervalManager
__all__ = [
'IntervalManager', 'ivalMgr']
from panda3d.core import *
from panda3d.direct import *
from ... | 30.145455 | 104 | 0.606152 | __all__ = [
'IntervalManager', 'ivalMgr']
from panda3d.core import *
from panda3d.direct import *
from direct.directnotify.DirectNotifyGlobal import *
from direct.showbase import EventManager
import fnmatch
class IntervalManager(CIntervalManager):
def __init__(self, globalPtr=0):
if globalPtr:
... | true | true |
1c489753a042f89c1412e6a49974168a517d4eef | 1,732 | py | Python | rpython/jit/metainterp/jitdriver.py | nanjekyejoannah/pypy | e80079fe13c29eda7b2a6b4cd4557051f975a2d9 | [
"Apache-2.0",
"OpenSSL"
] | 381 | 2018-08-18T03:37:22.000Z | 2022-02-06T23:57:36.000Z | rpython/jit/metainterp/jitdriver.py | nanjekyejoannah/pypy | e80079fe13c29eda7b2a6b4cd4557051f975a2d9 | [
"Apache-2.0",
"OpenSSL"
] | 16 | 2018-09-22T18:12:47.000Z | 2022-02-22T20:03:59.000Z | rpython/jit/metainterp/jitdriver.py | nanjekyejoannah/pypy | e80079fe13c29eda7b2a6b4cd4557051f975a2d9 | [
"Apache-2.0",
"OpenSSL"
] | 55 | 2015-08-16T02:41:30.000Z | 2022-03-20T20:33:35.000Z |
class JitDriverStaticData(object):
"""There is one instance of this class per JitDriver used in the program.
"""
# This is just a container with the following attributes (... set by):
# self.jitdriver ... rpython.jit.metainterp.warmspot
# self.portal_graph ... rpython.jit.metain... | 48.111111 | 77 | 0.677829 |
class JitDriverStaticData(object):
def _freeze_(self):
return True
| true | true |
1c4897c09868496a98ec5952939a8321eede329e | 6,342 | py | Python | sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/common_data_service_for_apps_linked_service_py3.py | tzhanl/azure-sdk-for-python | 18cd03f4ab8fd76cc0498f03e80fbc99f217c96e | [
"MIT"
] | 1 | 2021-06-02T08:01:35.000Z | 2021-06-02T08:01:35.000Z | sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/common_data_service_for_apps_linked_service_py3.py | tzhanl/azure-sdk-for-python | 18cd03f4ab8fd76cc0498f03e80fbc99f217c96e | [
"MIT"
] | 1 | 2020-03-06T05:57:16.000Z | 2020-03-06T05:57:16.000Z | sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/common_data_service_for_apps_linked_service_py3.py | tzhanl/azure-sdk-for-python | 18cd03f4ab8fd76cc0498f03e80fbc99f217c96e | [
"MIT"
] | null | null | null | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 54.672414 | 307 | 0.699306 |
from .linked_service_py3 import LinkedService
class CommonDataServiceForAppsLinkedService(LinkedService):
_validation = {
'type': {'required': True},
'deployment_type': {'required': True},
'authentication_type': {'required': True},
'username': {'required': True},
}
_attr... | true | true |
1c489884eecaeb3cdc0d1b3241dbc37a737987c1 | 619 | py | Python | sqrl/admin.py | JamesonNetworks/django-sqrl | b9a3e188267b393c8790e255d7ba7c0ab5b150af | [
"MIT"
] | 15 | 2015-05-26T13:26:33.000Z | 2020-11-24T22:38:05.000Z | sqrl/admin.py | JamesonNetworks/django-sqrl | b9a3e188267b393c8790e255d7ba7c0ab5b150af | [
"MIT"
] | 8 | 2015-03-18T05:18:58.000Z | 2021-03-05T11:27:58.000Z | sqrl/admin.py | JamesonNetworks/django-sqrl | b9a3e188267b393c8790e255d7ba7c0ab5b150af | [
"MIT"
] | 6 | 2018-03-05T21:11:54.000Z | 2021-03-05T11:28:08.000Z | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from django.contrib import admin
from .models import SQRLIdentity, SQRLNut
class SQRLIdentityAdmin(admin.ModelAdmin):
model = SQRLIdentity
list_display = (
'user',
'is_enabled',
'is_only_sqrl',
)
... | 19.34375 | 55 | 0.659128 | from __future__ import print_function, unicode_literals
from django.contrib import admin
from .models import SQRLIdentity, SQRLNut
class SQRLIdentityAdmin(admin.ModelAdmin):
model = SQRLIdentity
list_display = (
'user',
'is_enabled',
'is_only_sqrl',
)
raw_id_fields = (
... | true | true |
1c489893d6296039de8c94c076948082c5a5f64d | 2,041 | py | Python | vtools/datastore/station_info.py | CADWRDeltaModeling/vtools3 | 226bd2920c73f36dfc2f4eaedda8adccdfd1dfc3 | [
"Apache-2.0"
] | 5 | 2019-11-01T00:52:38.000Z | 2021-08-21T09:23:40.000Z | vtools/datastore/station_info.py | CADWRDeltaModeling/vtools3 | 226bd2920c73f36dfc2f4eaedda8adccdfd1dfc3 | [
"Apache-2.0"
] | 24 | 2019-11-08T17:16:51.000Z | 2022-03-15T22:55:23.000Z | vtools/datastore/station_info.py | CADWRDeltaModeling/vtools3 | 226bd2920c73f36dfc2f4eaedda8adccdfd1dfc3 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import pandas as pd
import argparse
from vtools.datastore import station_config
def station_info(search):
station_lookup = station_config.config_file("station_dbase")
if search == "config":
print(station_config.configuration())
return
... | 40.019608 | 126 | 0.636453 |
import sys
import pandas as pd
import argparse
from vtools.datastore import station_config
def station_info(search):
station_lookup = station_config.config_file("station_dbase")
if search == "config":
print(station_config.configuration())
return
slookup = pd.read_csv(station_lookup,sep... | true | true |
1c4898cb2432e1e81866bb361fc93755e430fd8a | 970 | py | Python | twilio/rest/preview/studio/__init__.py | scotta/twilio-python | 93cf463f914f55c4c4bd1c259b834953dd81609d | [
"MIT"
] | 30 | 2018-06-12T12:00:53.000Z | 2021-05-02T01:27:16.000Z | twilio/rest/preview/studio/__init__.py | kkrlee/twilio-python | 260de9df17c5a1440d9c037a971e2182da7f4ced | [
"MIT"
] | 10 | 2020-06-06T01:10:07.000Z | 2022-03-12T00:12:22.000Z | twilio/rest/preview/studio/__init__.py | kkrlee/twilio-python | 260de9df17c5a1440d9c037a971e2182da7f4ced | [
"MIT"
] | 4 | 2018-06-12T14:14:20.000Z | 2018-06-19T16:01:49.000Z | # coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.version import Version
from twilio.rest.preview.studio.flow import FlowList
class Studio(Version):
def __init__(self, domain):
"""
Initialize the Studio version... | 22.55814 | 56 | 0.574227 |
from twilio.base.version import Version
from twilio.rest.preview.studio.flow import FlowList
class Studio(Version):
def __init__(self, domain):
super(Studio, self).__init__(domain)
self.version = 'Studio'
self._flows = None
@property
def flows(self):
if self._flows is No... | true | true |
1c489ade360f7d303b3c54cdbfaad47137ac097e | 1,879 | py | Python | auth/views.py | raducc/micro-poc | a96f5107643910bed890470d85acf97a458aa3b3 | [
"MIT"
] | null | null | null | auth/views.py | raducc/micro-poc | a96f5107643910bed890470d85acf97a458aa3b3 | [
"MIT"
] | null | null | null | auth/views.py | raducc/micro-poc | a96f5107643910bed890470d85acf97a458aa3b3 | [
"MIT"
] | null | null | null | import datetime
import jwt
from flask import Blueprint, request, jsonify, make_response, current_app
from werkzeug.security import generate_password_hash, check_password_hash
from .models import db, Users
auth_app = Blueprint("auth", __name__)
@auth_app.route("/signup", methods=["POST"])
def signup():
data = re... | 28.044776 | 88 | 0.641299 | import datetime
import jwt
from flask import Blueprint, request, jsonify, make_response, current_app
from werkzeug.security import generate_password_hash, check_password_hash
from .models import db, Users
auth_app = Blueprint("auth", __name__)
@auth_app.route("/signup", methods=["POST"])
def signup():
data = re... | true | true |
1c489c82219bd48494ee350e6a9089e747467533 | 372 | py | Python | projeto.py | laurourbano/Projetos_Python | 50e7f4a7ff34158385ea7b635bac95ec8a0363a1 | [
"MIT"
] | 1 | 2021-12-28T02:51:34.000Z | 2021-12-28T02:51:34.000Z | projeto.py | laurourbano/Projetos_Python | 50e7f4a7ff34158385ea7b635bac95ec8a0363a1 | [
"MIT"
] | null | null | null | projeto.py | laurourbano/Projetos_Python | 50e7f4a7ff34158385ea7b635bac95ec8a0363a1 | [
"MIT"
] | null | null | null | import datetime
print("++++++++++++++++++")
print("ESCALA DE TRABALHO")
print("++++++++++++++++++")
def informar_cnpj():
cnpj = input("Informe o CNPJ da Empresa: ")
print("O CNPJ digitado foi: ", cnpj)
def informar_cpf():
cnpj = input("Informe o CNPJ da Empresa: ")
print("O CNPJ digitado foi: ", cnpj)... | 20.666667 | 47 | 0.596774 | import datetime
print("++++++++++++++++++")
print("ESCALA DE TRABALHO")
print("++++++++++++++++++")
def informar_cnpj():
cnpj = input("Informe o CNPJ da Empresa: ")
print("O CNPJ digitado foi: ", cnpj)
def informar_cpf():
cnpj = input("Informe o CNPJ da Empresa: ")
print("O CNPJ digitado foi: ", cnpj)... | true | true |
1c489ce456622e5f90885b80f7adb80f022c877e | 4,520 | py | Python | redash/utils/parameterized_query.py | howyi/redash | b68051d3c50df9a727df4c6ca5c6f70750d387d3 | [
"BSD-2-Clause"
] | 1 | 2019-03-24T03:38:32.000Z | 2019-03-24T03:38:32.000Z | redash/utils/parameterized_query.py | howyi/redash | b68051d3c50df9a727df4c6ca5c6f70750d387d3 | [
"BSD-2-Clause"
] | null | null | null | redash/utils/parameterized_query.py | howyi/redash | b68051d3c50df9a727df4c6ca5c6f70750d387d3 | [
"BSD-2-Clause"
] | 1 | 2019-03-20T09:22:43.000Z | 2019-03-20T09:22:43.000Z | import pystache
from functools import partial
from flask_login import current_user
from numbers import Number
from redash.utils import mustache_render, json_loads
from redash.permissions import require_access, view_only
from funcy import distinct
from dateutil.parser import parse
def _pluck_name_and_value(default_col... | 31.388889 | 125 | 0.669469 | import pystache
from functools import partial
from flask_login import current_user
from numbers import Number
from redash.utils import mustache_render, json_loads
from redash.permissions import require_access, view_only
from funcy import distinct
from dateutil.parser import parse
def _pluck_name_and_value(default_col... | true | true |
1c489d5952b9993695d02695326626bda781ef10 | 1,604 | py | Python | h2o-py/tests/testdir_algos/gbm/pyunit_offset_tweedieGBM.py | ChristosChristofidis/h2o-3 | 2a926c0950a98eff5a4c06aeaf0373e17176ecd8 | [
"Apache-2.0"
] | null | null | null | h2o-py/tests/testdir_algos/gbm/pyunit_offset_tweedieGBM.py | ChristosChristofidis/h2o-3 | 2a926c0950a98eff5a4c06aeaf0373e17176ecd8 | [
"Apache-2.0"
] | null | null | null | h2o-py/tests/testdir_algos/gbm/pyunit_offset_tweedieGBM.py | ChristosChristofidis/h2o-3 | 2a926c0950a98eff5a4c06aeaf0373e17176ecd8 | [
"Apache-2.0"
] | 1 | 2020-12-18T19:20:02.000Z | 2020-12-18T19:20:02.000Z | import sys
sys.path.insert(1, "../../../")
import h2o
def offset_tweedie(ip,port):
# Connect to a pre-existing cluster
h2o.init(ip,port)
insurance = h2o.import_frame(h2o.locate("smalldata/glm_test/insurance.csv"))
insurance["offset"] = insurance["Holders"].log()
gbm = h2o.gbm(x=insurance[0:3], y... | 47.176471 | 165 | 0.65212 | import sys
sys.path.insert(1, "../../../")
import h2o
def offset_tweedie(ip,port):
h2o.init(ip,port)
insurance = h2o.import_frame(h2o.locate("smalldata/glm_test/insurance.csv"))
insurance["offset"] = insurance["Holders"].log()
gbm = h2o.gbm(x=insurance[0:3], y=insurance["Claims"], distribution="... | true | true |
1c489ee1ca98570d16d82d34d9ab7209e83f6bce | 182 | py | Python | ldscriptures/cache.py | gabbarreiro/ldscriptures | f1de3acd6ae41886f1960a92aa26354621410916 | [
"Unlicense"
] | 7 | 2018-07-07T17:05:21.000Z | 2020-09-06T20:27:47.000Z | ldscriptures/cache.py | TGSec/ldscriptures | f1de3acd6ae41886f1960a92aa26354621410916 | [
"Unlicense"
] | null | null | null | ldscriptures/cache.py | TGSec/ldscriptures | f1de3acd6ae41886f1960a92aa26354621410916 | [
"Unlicense"
] | 1 | 2021-05-06T05:38:23.000Z | 2021-05-06T05:38:23.000Z | '''
import cachetools
from . import lang
enabled = True
maxsize = 1000
scriptures = {}
for each in lang.available:
scriptures[each] = cachetools.LRUCache(maxsize=maxsize)
''' | 14 | 59 | 0.714286 | true | true | |
1c489f41d4e4c12cd6f6407813ef2eac519893b1 | 276 | py | Python | mlpipeline/__init__.py | ahmed-shariff/mlpipeline | 03a07da44eab14171305e41e6d162def6c32c6ac | [
"MIT"
] | 5 | 2019-09-04T06:37:33.000Z | 2021-02-13T14:09:37.000Z | mlpipeline/__init__.py | ahmed-shariff/mlpipeline | 03a07da44eab14171305e41e6d162def6c32c6ac | [
"MIT"
] | 1 | 2020-02-21T20:06:07.000Z | 2020-02-21T20:06:17.000Z | mlpipeline/__init__.py | ahmed-shariff/mlpipeline | 03a07da44eab14171305e41e6d162def6c32c6ac | [
"MIT"
] | null | null | null | __version__ = "2.0.a.7.post.1"
from mlpipeline.utils._utils import (Versions,
log,
MetricContainer,
iterator)
__all__ = [Versions, log, MetricContainer, iterator]
| 30.666667 | 53 | 0.456522 | __version__ = "2.0.a.7.post.1"
from mlpipeline.utils._utils import (Versions,
log,
MetricContainer,
iterator)
__all__ = [Versions, log, MetricContainer, iterator]
| true | true |
1c48a02d0d934feb80680ef6f5e9dc4fa0948c10 | 1,636 | py | Python | tests/test_util.py | prafullat/fava | 27b1cc7368922696841b130b6efb419db691e95f | [
"MIT"
] | null | null | null | tests/test_util.py | prafullat/fava | 27b1cc7368922696841b130b6efb419db691e95f | [
"MIT"
] | null | null | null | tests/test_util.py | prafullat/fava | 27b1cc7368922696841b130b6efb419db691e95f | [
"MIT"
] | null | null | null | # pylint: disable=missing-docstring
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from fava.util import simple_wsgi, slugify, pairwise, listify, send_file_inline
from .conftest import data_file
def test_listify():
@listify
def fun():
for i in [1, 2, 3]:
yie... | 28.701754 | 79 | 0.625306 |
from werkzeug.test import Client
from werkzeug.wrappers import BaseResponse
from fava.util import simple_wsgi, slugify, pairwise, listify, send_file_inline
from .conftest import data_file
def test_listify():
@listify
def fun():
for i in [1, 2, 3]:
yield i
assert fun() == [1, 2, 3]
... | true | true |
1c48a04f443135c1a234bcf0ad9484b86d1bdd54 | 82 | py | Python | src/westpa/westext/adaptvoronoi/__init__.py | burntyellow/adelman_ci | cca251a51b34843faed0275cce01d7a307829993 | [
"MIT"
] | 140 | 2015-01-07T23:30:36.000Z | 2022-03-28T17:15:30.000Z | src/westext/adaptvoronoi/__init__.py | burntyellow/westpa | 9dc62478fcef0001b9c038cd56a40b6be1b9d64a | [
"MIT"
] | 157 | 2015-01-03T03:38:36.000Z | 2022-03-31T14:12:16.000Z | src/westext/adaptvoronoi/__init__.py | burntyellow/westpa | 9dc62478fcef0001b9c038cd56a40b6be1b9d64a | [
"MIT"
] | 56 | 2015-01-02T21:21:40.000Z | 2022-03-03T16:27:54.000Z |
from . import adaptVor_driver
from .adaptVor_driver import AdaptiveVoronoiDriver
| 20.5 | 50 | 0.865854 |
from . import adaptVor_driver
from .adaptVor_driver import AdaptiveVoronoiDriver
| true | true |
1c48a2353bbf942e33e7ee6d51eedceae67ac6aa | 850 | py | Python | alerta/plugins/remote_ip.py | sepich/alerta | 64d4e9f7bca6e41bda2d0553c846fbe68b494ab2 | [
"Apache-2.0"
] | 1 | 2019-08-15T02:37:21.000Z | 2019-08-15T02:37:21.000Z | alerta/plugins/remote_ip.py | sepich/alerta | 64d4e9f7bca6e41bda2d0553c846fbe68b494ab2 | [
"Apache-2.0"
] | null | null | null | alerta/plugins/remote_ip.py | sepich/alerta | 64d4e9f7bca6e41bda2d0553c846fbe68b494ab2 | [
"Apache-2.0"
] | 1 | 2021-03-11T18:19:22.000Z | 2021-03-11T18:19:22.000Z | import logging
from flask import request
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins')
class RemoteIpAddr(PluginBase):
"""
Add originating IP address of HTTP client as an alert attribute. This information
can be used for debugging, access control, or generating geoloca... | 27.419355 | 85 | 0.683529 | import logging
from flask import request
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins')
class RemoteIpAddr(PluginBase):
def pre_receive(self, alert, **kwargs):
if request.headers.getlist('X-Forwarded-For'):
alert.attributes.update(ip=request.headers.getlist... | true | true |
1c48a28d36981f4ff51423932bebd436d4b82cc8 | 6,491 | py | Python | python/ray/tests/conftest.py | ruiminshen/ray | b3564cda3d214cd19e9ea3804c21a46d5e14a914 | [
"Apache-2.0"
] | 3 | 2020-12-03T17:48:45.000Z | 2022-01-22T08:09:46.000Z | python/ray/tests/conftest.py | ruiminshen/ray | b3564cda3d214cd19e9ea3804c21a46d5e14a914 | [
"Apache-2.0"
] | 6 | 2022-03-18T14:06:24.000Z | 2022-03-26T07:13:16.000Z | python/ray/tests/conftest.py | ruiminshen/ray | b3564cda3d214cd19e9ea3804c21a46d5e14a914 | [
"Apache-2.0"
] | 1 | 2020-12-12T13:59:22.000Z | 2020-12-12T13:59:22.000Z | """
This file defines the common pytest fixtures used in current directory.
"""
import os
from contextlib import contextmanager
import pytest
import subprocess
import ray
from ray.cluster_utils import Cluster
from ray.test_utils import init_error_pubsub
@pytest.fixture
def shutdown_only():
yield None
# The c... | 26.279352 | 78 | 0.67817 | import os
from contextlib import contextmanager
import pytest
import subprocess
import ray
from ray.cluster_utils import Cluster
from ray.test_utils import init_error_pubsub
@pytest.fixture
def shutdown_only():
yield None
ray.shutdown()
def get_default_fixure_system_config():
system_config = {
... | true | true |
1c48a2bf8665c80a31e6b38f8e3c8439a55e959d | 13,218 | py | Python | bokeh/application/application.py | jensencl/bokeh_composite_formatter | fe497342779fe3d78a4710bd4dd6b48f2ffeb9a9 | [
"BSD-3-Clause"
] | 1 | 2020-02-07T16:57:56.000Z | 2020-02-07T16:57:56.000Z | bokeh/application/application.py | jakubwro/bokeh | 950f133f033df349d6f63b9750a909d5e64de21d | [
"BSD-3-Clause"
] | null | null | null | bokeh/application/application.py | jakubwro/bokeh | 950f133f033df349d6f63b9750a909d5e64de21d | [
"BSD-3-Clause"
] | null | null | null | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | 31.396675 | 102 | 0.53987 |
import logging log = logging.getLogger(__name__)
from abc import ABCMeta, abstractmethod
from ..document import Document
from ..settings import settings
__all__ = (
'Application',
'ServerContext',
'SessionContext',
)
class Application(object):
_is_a_bokeh_application_class = Tr... | true | true |
1c48a338a32c3c7e5b475c6feadb8c720cb47519 | 4,073 | py | Python | stage/configuration/test_encrypt_and_decrypt_fields_processor.py | Sentienz/datacollector-tests | ca27988351dc3366488098b5db6c85a8be2f7b85 | [
"Apache-2.0"
] | null | null | null | stage/configuration/test_encrypt_and_decrypt_fields_processor.py | Sentienz/datacollector-tests | ca27988351dc3366488098b5db6c85a8be2f7b85 | [
"Apache-2.0"
] | 1 | 2019-04-24T11:06:38.000Z | 2019-04-24T11:06:38.000Z | stage/configuration/test_encrypt_and_decrypt_fields_processor.py | anubandhan/datacollector-tests | 301c024c66d68353735256b262b681dd05ba16cc | [
"Apache-2.0"
] | 2 | 2019-05-24T06:34:37.000Z | 2020-03-30T11:48:18.000Z | import pytest
from streamsets.testframework.decorators import stub
@stub
@pytest.mark.parametrize('stage_attributes', [{'master_key_provider': 'AWS_KMS'}])
def test_access_key_id(sdc_builder, sdc_executor, stage_attributes):
pass
@stub
@pytest.mark.parametrize('stage_attributes', [{'master_key_provider': 'USER... | 32.325397 | 115 | 0.676897 | import pytest
from streamsets.testframework.decorators import stub
@stub
@pytest.mark.parametrize('stage_attributes', [{'master_key_provider': 'AWS_KMS'}])
def test_access_key_id(sdc_builder, sdc_executor, stage_attributes):
pass
@stub
@pytest.mark.parametrize('stage_attributes', [{'master_key_provider': 'USER... | true | true |
1c48a343d81bb32c43a561e24e4152b81e1da4b9 | 534 | py | Python | day_3_p2.py | 96arjan/AdventOfCode | 12f7e9fc1af37ba540b06ff4769a772acacca3cb | [
"MIT"
] | null | null | null | day_3_p2.py | 96arjan/AdventOfCode | 12f7e9fc1af37ba540b06ff4769a772acacca3cb | [
"MIT"
] | null | null | null | day_3_p2.py | 96arjan/AdventOfCode | 12f7e9fc1af37ba540b06ff4769a772acacca3cb | [
"MIT"
] | null | null | null | report = open(r"./data/day_3.txt", "r").read().split("\n")[:-1]
def do_recur(report, index, co2):
if len(report) == 1: return report[0]
ones, zeros, count = [], [], 0
for num in report:
if int(num[index]): count, ones = count + 1, ones + [num]
else: count, zeros = count - 1, zeros + [num]
... | 35.6 | 77 | 0.574906 | report = open(r"./data/day_3.txt", "r").read().split("\n")[:-1]
def do_recur(report, index, co2):
if len(report) == 1: return report[0]
ones, zeros, count = [], [], 0
for num in report:
if int(num[index]): count, ones = count + 1, ones + [num]
else: count, zeros = count - 1, zeros + [num]
... | true | true |
1c48a4221dda8e843fd3d8133c8d23f341c15095 | 6,335 | py | Python | data/external/repositories_2to3/139781/ndsb-master/caffe-dev/python/caffe/draw.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories_2to3/139781/ndsb-master/caffe-dev/python/caffe/draw.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | null | null | null | data/external/repositories_2to3/139781/ndsb-master/caffe-dev/python/caffe/draw.py | Keesiu/meta-kaggle | 87de739aba2399fd31072ee81b391f9b7a63f540 | [
"MIT"
] | 1 | 2019-12-04T08:23:33.000Z | 2019-12-04T08:23:33.000Z | """
Caffe network visualization: draw the NetParameter protobuffer.
NOTE: this requires pydot>=1.0.2, which is not included in requirements.txt
since it requires graphviz and other prerequisites outside the scope of the
Caffe.
"""
from caffe.proto import caffe_pb2
from google.protobuf import text_format
imp... | 36.408046 | 81 | 0.599842 |
from caffe.proto import caffe_pb2
from google.protobuf import text_format
import pydot
LAYER_STYLE_DEFAULT = {'shape': 'record', 'fillcolor': '#6495ED',
'style': 'filled'}
NEURON_LAYER_STYLE = {'shape': 'record', 'fillcolor': '#90EE90',
'style': 'filled'}
BLOB_STYLE = {'shape': 'octagon', '... | true | true |
1c48a5349351b9ed7a38ac04c2382b185a8a4863 | 164 | py | Python | categorias/iniciante/python/1013.py | carlos3g/URI-solutions | dc7f9b896cdff88aedf67611917b178d3ad60ab3 | [
"MIT"
] | 1 | 2022-01-26T23:38:17.000Z | 2022-01-26T23:38:17.000Z | categorias/iniciante/python/1013.py | carlos3g/URI-solutions | dc7f9b896cdff88aedf67611917b178d3ad60ab3 | [
"MIT"
] | 1 | 2020-07-12T00:49:35.000Z | 2021-06-26T20:53:18.000Z | categorias/iniciante/python/1013.py | carlos3g/URI-solutions | dc7f9b896cdff88aedf67611917b178d3ad60ab3 | [
"MIT"
] | 1 | 2020-07-04T03:27:04.000Z | 2020-07-04T03:27:04.000Z | # -*- coding: utf-8 -*-
a, b, c = map(int, input().split())
maior = (a+b+abs(a-b))/2
resultado = (maior+c+abs(maior-c))/2
print('{} eh o maior'.format(resultado))
| 23.428571 | 40 | 0.579268 |
a, b, c = map(int, input().split())
maior = (a+b+abs(a-b))/2
resultado = (maior+c+abs(maior-c))/2
print('{} eh o maior'.format(resultado))
| true | true |
1c48a59a6c3513233dcdc72f1f349d057f1c6cb0 | 4,298 | py | Python | dashlivesim/tests/test_startnr.py | Dash-Industry-Forum/dash-live-source-simulator | 23cb15c35656a731d9f6d78a30f2713eff2ec20d | [
"BSD-3-Clause"
] | 133 | 2015-04-26T04:37:35.000Z | 2022-02-27T16:37:40.000Z | dashlivesim/tests/test_startnr.py | Mani5GRockers/dash-live-source-simulator | 747cb23ba130049fd01c6446533f8dc1d3e9f62a | [
"BSD-3-Clause"
] | 83 | 2015-05-18T07:56:07.000Z | 2022-01-26T16:09:25.000Z | dashlivesim/tests/test_startnr.py | Mani5GRockers/dash-live-source-simulator | 747cb23ba130049fd01c6446533f8dc1d3e9f62a | [
"BSD-3-Clause"
] | 49 | 2015-06-29T22:46:21.000Z | 2022-01-07T14:32:34.000Z | # The copyright in this software is being made available under the BSD License,
# included below. This software may be subject to other third party and contributor
# rights, including patent rights, and no such rights are granted under this license.
#
# Copyright (c) 2015, Dash Industry Forum.
# All rights reserved.
#
... | 54.405063 | 108 | 0.734528 |
import unittest
from os.path import join
from dashlivesim.tests.dash_test_util import OUT_DIR
from dashlivesim.dashlib import dash_proxy, mpd_proxy
from dashlivesim.tests.dash_test_util import VOD_CONFIG_DIR, CONTENT_ROOT
from dashlivesim.tests.dash_test_util import findAllIndexes
class TestMpdChange(unittest.TestC... | true | true |
1c48a5b2e1b795384dc2e165d3eec19397fae69f | 26,141 | py | Python | pyia/data.py | adrn/gaia | dac05003f7952af88697b271295a90bb0df091ec | [
"MIT"
] | 15 | 2018-04-24T17:14:26.000Z | 2021-05-14T19:28:10.000Z | pyia/data.py | adrn/gaia | dac05003f7952af88697b271295a90bb0df091ec | [
"MIT"
] | 4 | 2019-03-11T22:59:36.000Z | 2021-10-17T14:37:24.000Z | pyia/data.py | adrn/pyia | dac05003f7952af88697b271295a90bb0df091ec | [
"MIT"
] | 7 | 2018-04-24T04:15:34.000Z | 2021-10-15T21:14:59.000Z | # coding: utf-8
""" Data structures. """
# Standard library
import pathlib
# Third-party
import astropy.coordinates as coord
from astropy.table import Table, Column
from astropy.time import Time
import astropy.units as u
import numpy as np
from .extinction import get_ext
from .ruwetools import U0Interpolator
__all_... | 34.854667 | 103 | 0.564898 |
import pathlib
import astropy.coordinates as coord
from astropy.table import Table, Column
from astropy.time import Time
import astropy.units as u
import numpy as np
from .extinction import get_ext
from .ruwetools import U0Interpolator
__all__ = ['GaiaData']
gaia_unit_map = {
'ra': u.degree,
'dec': u.degr... | true | true |
1c48a63aeb2b3796ce42ca504a0584918ac96541 | 8,704 | py | Python | VisualGimp/Util.py | duangsuse/VisualGimp | 79776fded12595ab3c56855b5ae56e2242780b2e | [
"MIT"
] | 2 | 2019-05-07T12:09:11.000Z | 2019-05-08T09:31:44.000Z | VisualGimp/Util.py | duangsuse-valid-projects/VisualGimp | 79776fded12595ab3c56855b5ae56e2242780b2e | [
"MIT"
] | null | null | null | VisualGimp/Util.py | duangsuse-valid-projects/VisualGimp | 79776fded12595ab3c56855b5ae56e2242780b2e | [
"MIT"
] | null | null | null | #!/usr/bin/env python2
# -*- encoding: utf-8 -*-
# Simple coding helper
# author: duangsuse
# date: Thu May 02 2019 CST
def infseq(x):
''' Infinity generator of x '''
while True: yield x
def nseq(x, n):
''' N length generator of x '''
while n > 0:
yield x
n -= 1
def may_slice(ary, ind):
''' if sl... | 26.864198 | 126 | 0.633502 |
def infseq(x):
while True: yield x
def nseq(x, n):
while n > 0:
yield x
n -= 1
def may_slice(ary, ind):
if type(ind) is not slice: return
if type(ary) is not list: return
start = ind.start
stop = ind.stop
len_list = len(ary)
if start < 0:
if start <= -len_list:
return ary[0:... | true | true |
1c48a657eee6323282e43dcd654c59dc1603a45b | 5,624 | py | Python | api/destination/base.py | ziegeer/autocert | 285df181508573918e280948e51cdd7c65743281 | [
"MIT"
] | null | null | null | api/destination/base.py | ziegeer/autocert | 285df181508573918e280948e51cdd7c65743281 | [
"MIT"
] | null | null | null | api/destination/base.py | ziegeer/autocert | 285df181508573918e280948e51cdd7c65743281 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
destination.base
'''
import itertools
from pprint import pformat
from attrdict import AttrDict
from utils.format import fmt, pfmt
from utils.exceptions import AutocertError
from app import app
class DestinationConnectivityError(AutocertError):
def __init__(self,... | 39.605634 | 146 | 0.630156 | import itertools
from pprint import pformat
from attrdict import AttrDict
from utils.format import fmt, pfmt
from utils.exceptions import AutocertError
from app import app
class DestinationConnectivityError(AutocertError):
def __init__(self, dest_ex_pairs):
msg = ''
for dest, ex in dest_ex_pairs:... | true | true |
1c48a6e236fc1adb1d930fd0e269173b1e610f96 | 3,078 | py | Python | tango_with_django_project/tango_with_django_project/settings.py | 2027205T/tangowithdjango | b7f0e55ee2807ba6531ee736e94098a4e30a96ed | [
"MIT"
] | null | null | null | tango_with_django_project/tango_with_django_project/settings.py | 2027205T/tangowithdjango | b7f0e55ee2807ba6531ee736e94098a4e30a96ed | [
"MIT"
] | null | null | null | tango_with_django_project/tango_with_django_project/settings.py | 2027205T/tangowithdjango | b7f0e55ee2807ba6531ee736e94098a4e30a96ed | [
"MIT"
] | null | null | null | """
Django settings for tango_with_django_project project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join... | 28.238532 | 147 | 0.74399 |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'k&en=nkp4c(bz*_h2h15a!c!jf&uiua-fca3_)9l4y7^!(o&fl'
DEBUG = False
TEMPLATE_DEBUG = True
TEMPLATE_PATH = os.path.join(BASE_DIR, 'templates')
TEMPLATE_DIRS = [ TEMPLATE_PATH, ]
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_... | true | true |
1c48a7e46d335ddc978171fea67312868be6e7b2 | 9,721 | py | Python | tools/azure-sdk-tools/devtools_testutils/proxy_testcase.py | xolve/azure-sdk-for-python | 9f5baa19c392f77f811d936ee43450e4ea524002 | [
"MIT"
] | null | null | null | tools/azure-sdk-tools/devtools_testutils/proxy_testcase.py | xolve/azure-sdk-for-python | 9f5baa19c392f77f811d936ee43450e4ea524002 | [
"MIT"
] | null | null | null | tools/azure-sdk-tools/devtools_testutils/proxy_testcase.py | xolve/azure-sdk-for-python | 9f5baa19c392f77f811d936ee43450e4ea524002 | [
"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.
# --------------------------------------------------------------------------
import os
... | 40.67364 | 120 | 0.668861 | import os
import logging
import requests
import six
import sys
from typing import TYPE_CHECKING
try:
import urllib.parse as url_parse
except:
import urlparse as url_parse
import pytest
import subprocess
from azure.core.exceptions import HttpResponseError, ResourceNotFoundError
from azure.core.pipelin... | true | true |
1c48a7ec9e8bcce337e61ad31b2fdf124e12ba99 | 2,489 | py | Python | logger.py | lvwuyunlifan/crop | 7392d007a8271ff384c5c66ed5717afbc4172b4d | [
"Apache-2.0"
] | null | null | null | logger.py | lvwuyunlifan/crop | 7392d007a8271ff384c5c66ed5717afbc4172b4d | [
"Apache-2.0"
] | null | null | null | logger.py | lvwuyunlifan/crop | 7392d007a8271ff384c5c66ed5717afbc4172b4d | [
"Apache-2.0"
] | null | null | null | # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514
import tensorflow as tf
import numpy as np
import scipy.misc
try:
from StringIO import StringIO # Python 2.7
except ImportError:
from io import BytesIO # Python 3.x
class Logger(object):
def __init__(self, log... | 22.223214 | 89 | 0.584974 |
import tensorflow as tf
import numpy as np
import scipy.misc
try:
from StringIO import StringIO
except ImportError:
from io import BytesIO
class Logger(object):
def __init__(self, log_dir):
self.writer = tf.summary.FileWriter(log_dir)
def scalar_summary(self, tag, value, step):
... | true | true |
1c48aac01a148b38c7ba99f01d288cdce7084c4d | 8,262 | py | Python | lib/Crypto/SelfTest/Cipher/test_OpenPGP.py | niulinlnc/pycryptodome | d902c929fcfdd0ece28e0c2e164a2aae78e3f4a2 | [
"Unlicense"
] | null | null | null | lib/Crypto/SelfTest/Cipher/test_OpenPGP.py | niulinlnc/pycryptodome | d902c929fcfdd0ece28e0c2e164a2aae78e3f4a2 | [
"Unlicense"
] | null | null | null | lib/Crypto/SelfTest/Cipher/test_OpenPGP.py | niulinlnc/pycryptodome | d902c929fcfdd0ece28e0c2e164a2aae78e3f4a2 | [
"Unlicense"
] | null | null | null | # ===================================================================
#
# Copyright (c) 2015, Legrandin <helderijs@gmail.com>
# 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. Redistributio... | 39.913043 | 85 | 0.671508 |
import unittest
from binascii import unhexlify
from Crypto.SelfTest.st_common import list_test_cases
from Crypto.Util.py3compat import tobytes
from Crypto.Cipher import AES, DES3, DES
from Crypto.Hash import SHAKE128
def get_tag_random(tag, length):
return SHAKE128.new(data=tobytes(tag)).read(length)
from Cryp... | true | true |
1c48ac07fa865efa223f340c554937bd46c9c70e | 7,872 | py | Python | server/openslides/agenda/config_variables.py | jonathankeuser/OpenSlides | 7ea9a9a6a1fe1e9f4c6d25c27f79e5a60858e2f6 | [
"MIT"
] | null | null | null | server/openslides/agenda/config_variables.py | jonathankeuser/OpenSlides | 7ea9a9a6a1fe1e9f4c6d25c27f79e5a60858e2f6 | [
"MIT"
] | null | null | null | server/openslides/agenda/config_variables.py | jonathankeuser/OpenSlides | 7ea9a9a6a1fe1e9f4c6d25c27f79e5a60858e2f6 | [
"MIT"
] | null | null | null | from django.core.validators import MaxLengthValidator, MinValueValidator
from openslides.core.config import ConfigVariable
def get_config_variables():
"""
Generator which yields all config variables of this app.
It has to be evaluated during app loading (see apps.py).
"""
# General
yield C... | 29.263941 | 98 | 0.603786 | from django.core.validators import MaxLengthValidator, MinValueValidator
from openslides.core.config import ConfigVariable
def get_config_variables():
yield ConfigVariable(
name="agenda_start_event_date_time",
default_value=None,
input_type="datetimepicker",
label="Begin of ... | true | true |
1c48ae2800ba9d5636b79fa22e0a6f1b12416057 | 13,480 | py | Python | docassemble_webapp/docassemble/webapp/file_access.py | silexsistemas/docassemble | ffde6eef64e09bfbdab599f06f8dd6499ec44f09 | [
"MIT"
] | 1 | 2019-12-29T22:33:48.000Z | 2019-12-29T22:33:48.000Z | docassemble_webapp/docassemble/webapp/file_access.py | silexsistemas/docassemble | ffde6eef64e09bfbdab599f06f8dd6499ec44f09 | [
"MIT"
] | 20 | 2020-03-24T18:20:54.000Z | 2022-03-12T00:19:20.000Z | docassemble_webapp/docassemble/webapp/file_access.py | silexsistemas/docassemble | ffde6eef64e09bfbdab599f06f8dd6499ec44f09 | [
"MIT"
] | null | null | null | from docassemble.base.logger import logmessage
import re
import os
import PyPDF2
import tempfile
import importlib
try:
from urllib.request import urlopen, Request
except ImportError:
from urllib2 import urlopen, Request
import mimetypes
from PIL import Image
import xml.etree.ElementTree as ET
import docassembl... | 46.643599 | 130 | 0.594139 | from docassemble.base.logger import logmessage
import re
import os
import PyPDF2
import tempfile
import importlib
try:
from urllib.request import urlopen, Request
except ImportError:
from urllib2 import urlopen, Request
import mimetypes
from PIL import Image
import xml.etree.ElementTree as ET
import docassembl... | true | true |
1c48aff799d42ca79db06796ca34d6954eca5df8 | 4,691 | py | Python | tutorials/frontend/from_keras.py | Exhorder6/tvm | 7e3f068373937c0ae08d58f67b84030a027db1c9 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | 90 | 2019-01-26T00:38:49.000Z | 2022-03-11T23:12:34.000Z | tutorials/frontend/from_keras.py | Exhorder6/tvm | 7e3f068373937c0ae08d58f67b84030a027db1c9 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | 91 | 2019-02-27T00:17:01.000Z | 2022-02-21T18:08:21.000Z | tutorials/frontend/from_keras.py | Exhorder6/tvm | 7e3f068373937c0ae08d58f67b84030a027db1c9 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | 41 | 2019-01-28T14:37:03.000Z | 2022-03-31T03:58:57.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 u... | 35.80916 | 82 | 0.655297 | import tvm
from tvm import te
import tvm.relay as relay
from tvm.contrib.download import download_testdata
import keras
import numpy as np
if tuple(keras.__version__.split(".")) < ("2", "4", "0"):
weights_url = "".join(
[
"https://github.com/fchollet/deep-learning-models/releases/",
... | true | true |
1c48b01cc0ac5761301f37029c367398c30b48c0 | 1,460 | py | Python | Unit_C/slam_06_c_multiply_distribution_question.py | tuongngoc/slam-tutorial-code | 14238852d51df9059ce55ffed92d95b286aec805 | [
"MIT"
] | 7 | 2017-06-03T15:40:20.000Z | 2021-05-17T16:05:58.000Z | Unit_C/slam_06_c_multiply_distribution_question.py | tuongngoc/slam-tutorial-code | 14238852d51df9059ce55ffed92d95b286aec805 | [
"MIT"
] | null | null | null | Unit_C/slam_06_c_multiply_distribution_question.py | tuongngoc/slam-tutorial-code | 14238852d51df9059ce55ffed92d95b286aec805 | [
"MIT"
] | 7 | 2017-06-03T15:40:26.000Z | 2020-08-12T12:11:41.000Z | # Multiply a distribution by another distribution.
# 06_c_multiply_distribution
# Claus Brenner, 26 NOV 2012
from pylab import plot, show, grid
from distribution import *
def multiply(a, b):
"""Multiply two distributions and return the resulting distribution."""
new_values = [a.value(b.offset+i)*b_va... | 35.609756 | 81 | 0.686986 | from pylab import plot, show, grid
from distribution import *
def multiply(a, b):
new_values = [a.value(b.offset+i)*b_val for i, b_val in enumerate(b.values)]
d = Distribution(b.offset, new_values)
d.normalize()
return d
if __name__ == '__main__':
arena = (0,1000)
position... | true | true |
1c48b136bbc070205a438fbc04db53f177dfacd2 | 2,578 | py | Python | scripts/study_case/ID_22/My_pytorch1.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 8 | 2021-06-30T06:55:14.000Z | 2022-03-18T01:57:14.000Z | scripts/study_case/ID_22/My_pytorch1.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 1 | 2021-06-30T03:08:15.000Z | 2021-06-30T03:08:15.000Z | scripts/study_case/ID_22/My_pytorch1.py | kzbnb/numerical_bugs | bc22e72bcc06df6ce7889a25e0aeed027bde910b | [
"Apache-2.0"
] | 2 | 2021-11-17T11:19:48.000Z | 2021-11-18T03:05:58.000Z | import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
from torchvision import datasets, transforms
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from torchvision.utils import make_grid , save_image
import sys
sys.path.append("/data")
batch_size ... | 31.439024 | 77 | 0.628394 | import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
from torchvision import datasets, transforms
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from torchvision.utils import make_grid , save_image
import sys
sys.path.append("/data")
batch_size ... | true | true |
1c48b1f7e5f9baf42a7e5d6111b47e524a3faf0a | 5,056 | py | Python | phising/data_type_valid/data_type_valid_train.py | sethusaim/Phising-Classification-Azure | 98f597444be18737f315686ce693f93edaa2b103 | [
"MIT"
] | null | null | null | phising/data_type_valid/data_type_valid_train.py | sethusaim/Phising-Classification-Azure | 98f597444be18737f315686ce693f93edaa2b103 | [
"MIT"
] | null | null | null | phising/data_type_valid/data_type_valid_train.py | sethusaim/Phising-Classification-Azure | 98f597444be18737f315686ce693f93edaa2b103 | [
"MIT"
] | null | null | null | from phising.blob_storage_operations.blob_operations import Blob_Operation
from phising.mongo_db_operations.mongo_operations import MongoDB_Operation
from utils.logger import App_Logger
from utils.read_params import read_params
class DB_Operation_Train:
"""
Description : This class shall be used for handli... | 33.045752 | 107 | 0.585245 | from phising.blob_storage_operations.blob_operations import Blob_Operation
from phising.mongo_db_operations.mongo_operations import MongoDB_Operation
from utils.logger import App_Logger
from utils.read_params import read_params
class DB_Operation_Train:
def __init__(self):
self.config = read_params()
... | true | true |
1c48b46ca3eccad0bc0a519bddb6c7a4511e1488 | 3,026 | py | Python | PyLB/IO.py | pastewka/LBWithPython | a913683afa55b77395189b4c5d95f836599a91cb | [
"MIT"
] | 1 | 2022-03-19T13:48:28.000Z | 2022-03-19T13:48:28.000Z | PyLB/IO.py | IMTEK-Simulation/LBWithPython | a913683afa55b77395189b4c5d95f836599a91cb | [
"MIT"
] | 1 | 2021-12-08T09:24:42.000Z | 2021-12-08T09:24:42.000Z | PyLB/IO.py | IMTEK-Simulation/LBWithPython | a913683afa55b77395189b4c5d95f836599a91cb | [
"MIT"
] | 2 | 2021-06-07T14:24:51.000Z | 2021-08-15T15:12:52.000Z | # Copyright 2017-2018 Lars Pastewka, Andreas Greiner
#
# 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, me... | 37.358025 | 80 | 0.689028 |
import numpy as np
from mpi4py import MPI
def save_mpiio(comm, fn, g_kl):
from numpy.lib.format import dtype_to_descr, magic
magic_str = magic(1, 0)
local_nx, local_ny = g_kl.shape
nx = np.empty_like(local_nx)
ny = np.empty_like(local_ny)
commx = comm.Sub((True, False))
commy = comm.Su... | true | true |
1c48b4a673eba893ad4a41d0434a1f394309e428 | 659 | py | Python | pkg/pkg/utils/toy.py | neurodata/bilateral-connectome | 2335bd444040ff647a4cd3304bddf7f533e490a7 | [
"MIT"
] | 2 | 2021-09-24T20:21:18.000Z | 2022-02-08T18:31:29.000Z | pkg/pkg/utils/toy.py | neurodata/bgm | b04162f84820f81cf719e8a5ddd4dae34d8f5f41 | [
"MIT"
] | 9 | 2021-09-29T17:23:41.000Z | 2022-03-16T20:22:04.000Z | pkg/pkg/utils/toy.py | neurodata/bgm | b04162f84820f81cf719e8a5ddd4dae34d8f5f41 | [
"MIT"
] | 2 | 2021-11-16T16:17:53.000Z | 2022-03-26T01:25:10.000Z | import numpy as np
import pandas as pd
import seaborn as sns
from graspologic.simulations import sbm
def sample_toy_networks(seed=888888, ns=None, B=None):
np.random.seed(seed)
if ns is None:
ns = [5, 6, 7]
if B is None:
B = np.array([[0.8, 0.2, 0.05], [0.05, 0.9, 0.2], [0.05, 0.05, 0.7]])... | 28.652174 | 77 | 0.632777 | import numpy as np
import pandas as pd
import seaborn as sns
from graspologic.simulations import sbm
def sample_toy_networks(seed=888888, ns=None, B=None):
np.random.seed(seed)
if ns is None:
ns = [5, 6, 7]
if B is None:
B = np.array([[0.8, 0.2, 0.05], [0.05, 0.9, 0.2], [0.05, 0.05, 0.7]])... | true | true |
1c48b4ff77f16456c4d2ccbf2ebf5ccef234b70c | 9,572 | py | Python | disent/frameworks/vae/_unsupervised__infovae.py | neonkitchen/disent | 0f45fefea03473690dfdbf48ef83f6e17ca9b8b3 | [
"MIT"
] | null | null | null | disent/frameworks/vae/_unsupervised__infovae.py | neonkitchen/disent | 0f45fefea03473690dfdbf48ef83f6e17ca9b8b3 | [
"MIT"
] | null | null | null | disent/frameworks/vae/_unsupervised__infovae.py | neonkitchen/disent | 0f45fefea03473690dfdbf48ef83f6e17ca9b8b3 | [
"MIT"
] | 1 | 2022-01-18T06:43:33.000Z | 2022-01-18T06:43:33.000Z | # ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 Nathan Juraj Michlo
#
# 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 Softwar... | 45.364929 | 127 | 0.573234 |
from dataclasses import dataclass
from typing import Sequence
import numpy as np
import torch
from torch import Tensor
from torch.distributions import Normal
from disent.frameworks.vae._unsupervised__vae import Vae
class InfoVae(Vae):
REQUIRED_OBS = 1
@dataclass
class cfg(Vae.cfg):
info_alp... | true | true |
1c48b546031f0533e11cbc81352d342ede099412 | 492 | py | Python | src/ch16-mongodb-version/starter/pypi_nosql/pypi/controllers/home_controller.py | possnfiffer/data-driven-web-apps-with-pyramid-and-sqlalchemy | 880dc4bc2a6d5dd5fcc91452725d5a1c7c9022c5 | [
"MIT"
] | 83 | 2018-07-04T22:19:20.000Z | 2022-03-09T22:44:48.000Z | src/ch16-mongodb-version/starter/pypi_nosql/pypi/controllers/home_controller.py | possnfiffer/data-driven-web-apps-with-pyramid-and-sqlalchemy | 880dc4bc2a6d5dd5fcc91452725d5a1c7c9022c5 | [
"MIT"
] | 9 | 2018-08-02T00:17:33.000Z | 2021-11-17T17:18:05.000Z | src/ch16-mongodb-version/starter/pypi_nosql/pypi/controllers/home_controller.py | possnfiffer/data-driven-web-apps-with-pyramid-and-sqlalchemy | 880dc4bc2a6d5dd5fcc91452725d5a1c7c9022c5 | [
"MIT"
] | 78 | 2018-07-28T14:07:07.000Z | 2022-01-15T07:06:42.000Z | from pyramid.view import view_config
from pypi.viewmodels.home.home_index_viewmodel import HomeIndexViewModel
from pypi.viewmodels.shared.viewmodel_base import ViewModelBase
@view_config(route_name='home', renderer='pypi:templates/home/index.pt')
def home_index(request):
vm = HomeIndexViewModel(request)
retur... | 30.75 | 73 | 0.79065 | from pyramid.view import view_config
from pypi.viewmodels.home.home_index_viewmodel import HomeIndexViewModel
from pypi.viewmodels.shared.viewmodel_base import ViewModelBase
@view_config(route_name='home', renderer='pypi:templates/home/index.pt')
def home_index(request):
vm = HomeIndexViewModel(request)
retur... | true | true |
1c48b5e6ea648f2f13d47f5e4544e1b00c814fca | 3,071 | py | Python | tf_dot_general/tf_dot_general_test.py | DarrenZhang01/Neural_Tangents_TensorFlow | 2fd360c8b1b8c9106044034f6a8b5c2734db9c3d | [
"Apache-2.0"
] | 4 | 2020-12-25T17:37:13.000Z | 2022-01-03T17:00:23.000Z | tf_dot_general/tf_dot_general_test.py | DarrenZhang01/TensorFlow_GSoC | 2fd360c8b1b8c9106044034f6a8b5c2734db9c3d | [
"Apache-2.0"
] | 33 | 2020-07-18T18:57:54.000Z | 2020-08-17T13:58:46.000Z | tf_dot_general/tf_dot_general_test.py | DarrenZhang01/Neural_Tangents_TensorFlow | 2fd360c8b1b8c9106044034f6a8b5c2734db9c3d | [
"Apache-2.0"
] | 1 | 2021-08-16T19:00:06.000Z | 2021-08-16T19:00:06.000Z | # Copyright 2020 The TensorFlow 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 applica... | 38.873418 | 80 | 0.535656 |
import tensorflow as tf
from tensorflow.python.platform import test
import numpy as np
import jax.numpy as jnp
from jax import lax
from tf_dot_general import *
from absl.testing import parameterized
class TFConvGeneralTest(test.TestCase, parameterized.TestCase):
@parameterized.parameters(
{"lhs": ['i', 'j'... | true | true |
1c48b6acf5248277954d3f56227f28df99280d78 | 8,521 | py | Python | 20200602_homework_week8/xue/assignment2/skin_dect_v1.py | DTRademaker/DL_tutorials_2020 | aaae2833c084547e027e51ebeb0abf6bcd336897 | [
"Apache-2.0"
] | null | null | null | 20200602_homework_week8/xue/assignment2/skin_dect_v1.py | DTRademaker/DL_tutorials_2020 | aaae2833c084547e027e51ebeb0abf6bcd336897 | [
"Apache-2.0"
] | null | null | null | 20200602_homework_week8/xue/assignment2/skin_dect_v1.py | DTRademaker/DL_tutorials_2020 | aaae2833c084547e027e51ebeb0abf6bcd336897 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Li Xue
# 3-Jul-2020 16:01
import os
import sys
import re
from os import listdir
import shutil
import glob
from PIL import Image
import imageio
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchsummary import summary
import torch.utils.data as data_utils
from matplotl... | 33.415686 | 126 | 0.645816 |
import os
import sys
import re
from os import listdir
import shutil
import glob
from PIL import Image
import imageio
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchsummary import summary
import torch.utils.data as data_utils
from matplotlib import pyplot as plt
import numpy as np
import p... | true | true |
1c48b8b8acba07ae3f975d62e14e3107708605ad | 2,779 | py | Python | densmap/densmap.py | hhcho/densvis | d65bb3133a5072356f45d2d6f4f0d16ad33032fd | [
"MIT"
] | 102 | 2020-05-15T14:17:17.000Z | 2022-03-23T08:38:24.000Z | densmap/densmap.py | hhcho/densvis | d65bb3133a5072356f45d2d6f4f0d16ad33032fd | [
"MIT"
] | 11 | 2020-05-16T12:02:19.000Z | 2022-03-22T16:41:43.000Z | densmap/densmap.py | hhcho/densvis | d65bb3133a5072356f45d2d6f4f0d16ad33032fd | [
"MIT"
] | 11 | 2020-05-15T22:06:57.000Z | 2021-08-18T14:13:15.000Z | import sys
import numpy as np
import argparse
import pickle
import densmap
from sklearn.datasets import load_digits
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-i','--input', help='Input .txt or .pkl', default='data.txt')
parser.add_argument('-o','--outname... | 38.597222 | 124 | 0.594818 | import sys
import numpy as np
import argparse
import pickle
import densmap
from sklearn.datasets import load_digits
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-i','--input', help='Input .txt or .pkl', default='data.txt')
parser.add_argument('-o','--outname... | true | true |
1c48b9b45a802cd383a85fca3e4fa2436b12d4f7 | 24,710 | py | Python | extern_tools/mmd_tools_local/core/morph.py | block2333/CATSzh-CNLang | b47b68c7fc944c30bcf666773308927ca81967e5 | [
"MIT"
] | 3 | 2021-11-03T15:14:35.000Z | 2021-12-10T05:35:38.000Z | extern_tools/mmd_tools_local/core/morph.py | Vapey/cats-blender-plugin | bbc081c504e4fbb28b89e4d0d3b8a716b00bc334 | [
"MIT"
] | null | null | null | extern_tools/mmd_tools_local/core/morph.py | Vapey/cats-blender-plugin | bbc081c504e4fbb28b89e4d0d3b8a716b00bc334 | [
"MIT"
] | 1 | 2021-01-28T12:19:40.000Z | 2021-01-28T12:19:40.000Z | # -*- coding: utf-8 -*-
import re
import bpy
from mmd_tools_local import bpyutils
from mmd_tools_local.bpyutils import SceneOp
from mmd_tools_local.bpyutils import ObjectOp
from mmd_tools_local.bpyutils import TransformConstraintOp
class FnMorph(object):
def __init__(self, morph, model):
self.__morph = m... | 44.927273 | 127 | 0.581991 | import re
import bpy
from mmd_tools_local import bpyutils
from mmd_tools_local.bpyutils import SceneOp
from mmd_tools_local.bpyutils import ObjectOp
from mmd_tools_local.bpyutils import TransformConstraintOp
class FnMorph(object):
def __init__(self, morph, model):
self.__morph = morph
self.__rig ... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.