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 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f75e724a0c22b739656f3ae2548a8fb43d261090 | 24,789 | py | Python | ove/algorithm/basicvsr/fix_model.py | iBobbyTS/OpenVideoEnhance | 64d12d7a4c344798e5d60eafd20f8f554f852e84 | [
"MIT"
] | 3 | 2020-12-20T14:15:19.000Z | 2021-03-23T12:23:38.000Z | ove/algorithm/basicvsr/fix_model.py | iBobbyTS/OpenVideoEnhance | 64d12d7a4c344798e5d60eafd20f8f554f852e84 | [
"MIT"
] | 1 | 2022-01-17T06:39:20.000Z | 2022-01-18T08:12:38.000Z | ove/algorithm/basicvsr/fix_model.py | iBobbyTS/OpenVideoEnhance | 64d12d7a4c344798e5d60eafd20f8f554f852e84 | [
"MIT"
] | 1 | 2021-03-03T22:53:05.000Z | 2021-03-03T22:53:05.000Z | import torch
ori = torch.load('/Users/ibobby/Dataset/model_weights/BasicVSR/v-bi.pth')
ori = ori['state_dict']
new = {}
for k in ori.keys():
new[k.replace('generator.', '')] = ori[k]
# Rename
m = list()
u = list()
# PixelShufflePack
m += ["upsample1.main.0.weight", "upsample1.main.0.bias", "upsample2.main.0.weight"... | 708.257143 | 10,365 | 0.785752 | import torch
ori = torch.load('/Users/ibobby/Dataset/model_weights/BasicVSR/v-bi.pth')
ori = ori['state_dict']
new = {}
for k in ori.keys():
new[k.replace('generator.', '')] = ori[k]
m = list()
u = list()
m += ["upsample1.main.0.weight", "upsample1.main.0.bias", "upsample2.main.0.weight", "upsample2.main.0.bias"]
u... | true | true |
f75e727f2acdf54530927206376d91f23d3d03fd | 1,080 | py | Python | tflite/ResizeNearestNeighborOptions.py | FrozenGene/tflite | a0703a4f778a1aaf25310149ea51935ca9b3487b | [
"Apache-2.0"
] | 14 | 2019-01-04T03:50:41.000Z | 2021-02-23T09:23:30.000Z | tflite/ResizeNearestNeighborOptions.py | FrozenGene/tflite | a0703a4f778a1aaf25310149ea51935ca9b3487b | [
"Apache-2.0"
] | 2 | 2019-06-25T02:16:39.000Z | 2019-07-31T13:23:05.000Z | tflite/ResizeNearestNeighborOptions.py | FrozenGene/tflite | a0703a4f778a1aaf25310149ea51935ca9b3487b | [
"Apache-2.0"
] | 7 | 2019-01-04T15:52:41.000Z | 2022-03-15T00:00:17.000Z | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
class ResizeNearestNeighborOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsResizeNearestNeighborOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uof... | 34.83871 | 115 | 0.734259 |
import flatbuffers
class ResizeNearestNeighborOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsResizeNearestNeighborOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ResizeNearestNeighborOptions()
x.Init(buf, n + off... | true | true |
f75e72e65fd810188d688cecffb754717ff4e366 | 916 | py | Python | opps/sitemaps/urls.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | 1 | 2015-11-05T17:33:25.000Z | 2015-11-05T17:33:25.000Z | opps/sitemaps/urls.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | null | null | null | opps/sitemaps/urls.py | jeanmask/opps | 031c6136c38d43aa6d1ccb25a94f7bcd65ccbf87 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.core.cache import cache_page
from opps.sitemaps.sitemaps import GenericSitemap, InfoDict
from opps.sitemaps.views import sitemap
sitemaps = {
'containers':... | 29.548387 | 65 | 0.679039 | from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.core.cache import cache_page
from opps.sitemaps.sitemaps import GenericSitemap, InfoDict
from opps.sitemaps.views import sitemap
sitemaps = {
'containers': GenericSitemap(InfoDict(), priority=0.6),
}
... | true | true |
f75e7320727a4f55b7009b4f3f63936861ee8e7b | 8,266 | py | Python | src/simulator.py | scottma/aws-batch-monte-carlo-workshop | 52e14f1e2ee287b91dbc15abdb2fb55c7fef4693 | [
"MIT"
] | 1 | 2021-07-06T20:00:07.000Z | 2021-07-06T20:00:07.000Z | src/simulator.py | scottma/aws-batch-monte-carlo-workshop | 52e14f1e2ee287b91dbc15abdb2fb55c7fef4693 | [
"MIT"
] | null | null | null | src/simulator.py | scottma/aws-batch-monte-carlo-workshop | 52e14f1e2ee287b91dbc15abdb2fb55c7fef4693 | [
"MIT"
] | null | null | null | '''
ver 0.1, namera@ , initial-release, Oct26'17
ver 0.2, namera@ , included execution id for traceability, Nov3'17
ver 0.3, shawo@ , Corrected typos in variable names, Apr23'18
ver 0.4, angelaw@ , Added S3 upload flag, removed risk calculations, Oct17'18
Hedge Your Own Funds: Running Monte Carlo Simulations on AWS... | 40.519608 | 145 | 0.681587 |
import pandas as pd
from pandas_datareader import data as pdr
import numpy as np
import datetime, time
from math import sqrt
import yfinance as yf
import boto3
import uuid
import subprocess
import argparse
s3 = boto3.client('s3')
def saveToS3(bucket_name, filename, STOCK):
if bucket_name is not None:
s... | true | true |
f75e741cc8ff0f14d5d136cd0fbc939802e0c2fd | 2,789 | py | Python | inference/tnbc_infer_cv3.py | dliu5812/PFFNet | d7f3257cb31812f960d6abeec14a0ac3fedeb273 | [
"MIT"
] | 8 | 2021-04-14T11:11:58.000Z | 2022-03-07T13:52:19.000Z | inference/tnbc_infer_cv3.py | sublatelog/PFFNet | f5a706236a8bac04204cfa90f5cc66c2573ca671 | [
"MIT"
] | 4 | 2021-04-14T11:25:57.000Z | 2022-01-21T06:26:59.000Z | inference/tnbc_infer_cv3.py | sublatelog/PFFNet | f5a706236a8bac04204cfa90f5cc66c2573ca671 | [
"MIT"
] | 2 | 2021-05-16T13:58:53.000Z | 2021-07-29T06:49:03.000Z |
import cv2
import numpy as np
from maskrcnn_benchmark.utils.miscellaneous import mkdir
import tifffile as tiff
from inference.cell_predictor import CellDemo
from maskrcnn_benchmark.modeling.detector import build_detection_model
import os
from inference.metrics import mask2out, removeoverlap
def select_test_fold... | 27.89 | 164 | 0.676945 |
import cv2
import numpy as np
from maskrcnn_benchmark.utils.miscellaneous import mkdir
import tifffile as tiff
from inference.cell_predictor import CellDemo
from maskrcnn_benchmark.modeling.detector import build_detection_model
import os
from inference.metrics import mask2out, removeoverlap
def select_test_fold... | true | true |
f75e7470d09c8eed64a4374e97d742d676b20d20 | 2,235 | py | Python | integreat_cms/cms/views/users/user_list_view.py | Integreat/cms-v2 | c79a54fd5abb792696420aa6427a5e5a356fa79c | [
"Apache-2.0"
] | 21 | 2018-10-26T20:10:45.000Z | 2020-10-22T09:41:46.000Z | integreat_cms/cms/views/users/user_list_view.py | Integreat/cms-v2 | c79a54fd5abb792696420aa6427a5e5a356fa79c | [
"Apache-2.0"
] | 392 | 2018-10-25T08:34:07.000Z | 2020-11-19T08:20:30.000Z | integreat_cms/cms/views/users/user_list_view.py | Integreat/cms-v2 | c79a54fd5abb792696420aa6427a5e5a356fa79c | [
"Apache-2.0"
] | 23 | 2019-03-06T17:11:35.000Z | 2020-10-16T04:36:41.000Z | import logging
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.paginator import Paginator
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from ...decorators import permission_require... | 31.478873 | 101 | 0.651902 | import logging
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.paginator import Paginator
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views.generic import TemplateView
from ...decorators import permission_require... | true | true |
f75e76076cefda5f39e0b55fb2460e26c313aaeb | 11,924 | py | Python | tests/test_ref.py | wbrefvem/python-bitbucket | b5002a97f0dd9d02dfc60f81b3a13d966abad9aa | [
"Apache-2.0"
] | 2 | 2017-06-23T01:03:20.000Z | 2019-02-27T14:13:39.000Z | tests/test_ref.py | wbrefvem/python-bitbucket | b5002a97f0dd9d02dfc60f81b3a13d966abad9aa | [
"Apache-2.0"
] | 1 | 2019-02-27T14:14:33.000Z | 2021-01-11T13:02:53.000Z | tests/test_ref.py | wbrefvem/python-bitbucket | b5002a97f0dd9d02dfc60f81b3a13d966abad9aa | [
"Apache-2.0"
] | 1 | 2020-11-04T03:35:04.000Z | 2020-11-04T03:35:04.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from test_bitbucketbase import BitbucketFixture
import json
import httpretty
from uritemplate import expand
from pybitbucket.ref import (Ref, Tag, Branch)
from pybitbucket.bitbucket import Bitbucket
from pybitbucket.commit import Commit
from pybitbucket... | 30.035264 | 71 | 0.61741 |
from __future__ import unicode_literals
from test_bitbucketbase import BitbucketFixture
import json
import httpretty
from uritemplate import expand
from pybitbucket.ref import (Ref, Tag, Branch)
from pybitbucket.bitbucket import Bitbucket
from pybitbucket.commit import Commit
from pybitbucket.repository import Repos... | true | true |
f75e764562d701746f7bc6ced82b3db55c4eda41 | 2,502 | py | Python | generate_OPENSMILE_features_csv.py | openalgorithmdevelopers/MATSS-Original | 76b9cc7a23fd83b0cca0249addcccabd9bb8bf92 | [
"Apache-2.0"
] | null | null | null | generate_OPENSMILE_features_csv.py | openalgorithmdevelopers/MATSS-Original | 76b9cc7a23fd83b0cca0249addcccabd9bb8bf92 | [
"Apache-2.0"
] | null | null | null | generate_OPENSMILE_features_csv.py | openalgorithmdevelopers/MATSS-Original | 76b9cc7a23fd83b0cca0249addcccabd9bb8bf92 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 28 17:46:55 2021
@author: bhupendra.singh
"""
import numpy as np
import pandas as pd
from tqdm import tqdm
import opensmile
totalSubjects = 21
totalUtterances = 60 #the number of utterances of words in a folder for every subject
featureName = "mfcc"... | 43.137931 | 145 | 0.703837 |
import numpy as np
import pandas as pd
from tqdm import tqdm
import opensmile
totalSubjects = 21
totalUtterances = 60 featureName = "mfcc"
features_length = 6373
utterancesFolder = ".//WebBasedTest/word_level_utterances_manual"
featuresFolder = ".//WebBasedTest/features_files"
avialableSubjectLi... | true | true |
f75e76c8bf488cc380a5c34731225e357dd4671c | 356 | py | Python | networks/resnet34.py | TobyLing/Comparative-Study-of-Deep-Learning-Models-for-Segmentation-of-Corpus-Callosum | c1840440c29e1bcc6fac3830003b026d7f452513 | [
"Apache-2.0"
] | 1 | 2021-04-18T14:05:33.000Z | 2021-04-18T14:05:33.000Z | networks/resnet34.py | TobyLing/Comparative-Study-of-Deep-Learning-Models-for-Segmentation-of-Corpus-Callosum | c1840440c29e1bcc6fac3830003b026d7f452513 | [
"Apache-2.0"
] | null | null | null | networks/resnet34.py | TobyLing/Comparative-Study-of-Deep-Learning-Models-for-Segmentation-of-Corpus-Callosum | c1840440c29e1bcc6fac3830003b026d7f452513 | [
"Apache-2.0"
] | null | null | null | import torch
from torchvision import models
from tensorboardX import SummaryWriter
writer = SummaryWriter()
resnet = models.resnet34(pretrained=True)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = resnet.to(device)
dummy_input = torch.zeros(8, 3,512,512)
writer.add_graph(model, du... | 16.181818 | 69 | 0.764045 | import torch
from torchvision import models
from tensorboardX import SummaryWriter
writer = SummaryWriter()
resnet = models.resnet34(pretrained=True)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = resnet.to(device)
dummy_input = torch.zeros(8, 3,512,512)
writer.add_graph(model, du... | true | true |
f75e76e55cc272c988a8d5d83c94fe040c759dac | 1,441 | py | Python | src/95.py | cloudzfy/euler | b82efad753ee98375fd40ec4e3989be57828e82c | [
"MIT"
] | 12 | 2016-10-19T09:03:20.000Z | 2021-01-10T10:53:23.000Z | src/95.py | cloudzfy/euler | b82efad753ee98375fd40ec4e3989be57828e82c | [
"MIT"
] | null | null | null | src/95.py | cloudzfy/euler | b82efad753ee98375fd40ec4e3989be57828e82c | [
"MIT"
] | 6 | 2018-09-12T03:13:58.000Z | 2021-07-07T00:29:43.000Z | # The proper divisors of a number are all the divisors excluding
# the number itself. For example, the proper divisors of 28 are
# 1, 2, 4, 7, and 14. As the sum of these divisors is equal to 28,
# we call it a perfect number.
# Interestingly the sum of the proper divisors of 220 is 284 and
# the sum of the proper div... | 24.423729 | 66 | 0.660652 |
amicable = {}
limit = 1000000
sums = [1 for i in range(limit + 1)]
for i in range(2, limit / 2 + 1):
for j in range(i + i, limit + 1, i):
sums[j] += i
sums[1] = limit + 1
for i in range(2, limit + 1):
if i in amicable:
continue
num = i
seq = [num]
while True:
num = sums[num]
if num in seq:
whil... | false | true |
f75e775f77f9725aebe13432f47e65f19196575e | 360 | py | Python | WebMirror/management/rss_parser_funcs/feed_parse_extractManaTankMagus.py | fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | [
"BSD-3-Clause"
] | 193 | 2016-08-02T22:04:35.000Z | 2022-03-09T20:45:41.000Z | WebMirror/management/rss_parser_funcs/feed_parse_extractManaTankMagus.py | fake-name/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | [
"BSD-3-Clause"
] | 533 | 2016-08-23T20:48:23.000Z | 2022-03-28T15:55:13.000Z | WebMirror/management/rss_parser_funcs/feed_parse_extractManaTankMagus.py | rrosajp/ReadableWebProxy | ed5c7abe38706acc2684a1e6cd80242a03c5f010 | [
"BSD-3-Clause"
] | 19 | 2015-08-13T18:01:08.000Z | 2021-07-12T17:13:09.000Z | def extractManaTankMagus(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Mana Tank Magus' in item['tags']:
return buildReleaseMessageWithType(item, 'Mana Tank Magus', vol, chp, frag=frag, postfi... | 32.727273 | 114 | 0.713889 | def extractManaTankMagus(item):
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'Mana Tank Magus' in item['tags']:
return buildReleaseMessageWithType(item, 'Mana Tank Magus', vol, chp, frag=frag, postfix=postfix, ... | true | true |
f75e790fd1ea720ad28bb376802418404df94fd0 | 525 | py | Python | bootcamp/articles/migrations/0011_alter_article_content.py | elbakouchi/bootcamp | 2c7a0cd2ddb7632acb3009f94d728792ddf9644f | [
"MIT"
] | null | null | null | bootcamp/articles/migrations/0011_alter_article_content.py | elbakouchi/bootcamp | 2c7a0cd2ddb7632acb3009f94d728792ddf9644f | [
"MIT"
] | null | null | null | bootcamp/articles/migrations/0011_alter_article_content.py | elbakouchi/bootcamp | 2c7a0cd2ddb7632acb3009f94d728792ddf9644f | [
"MIT"
] | null | null | null | # Generated by Django 3.2.12 on 2022-04-22 23:25
import bootcamp.custom
from django.db import migrations
import django_ckeditor_5.fields
class Migration(migrations.Migration):
dependencies = [
('articles', '0010_alter_article_content'),
]
operations = [
migrations.AlterField(
... | 25 | 135 | 0.678095 |
import bootcamp.custom
from django.db import migrations
import django_ckeditor_5.fields
class Migration(migrations.Migration):
dependencies = [
('articles', '0010_alter_article_content'),
]
operations = [
migrations.AlterField(
model_name='article',
name='content... | true | true |
f75e79425f7fadf449872021037247a79b8fbd35 | 2,554 | py | Python | toolchain/osx/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/lib/hard/libstdc++.a-gdb.py | ChangsoonKim/STM32F7DiscTutor | 024e9e3b4d0e7c10f751b7e4ce95200815906794 | [
"MIT"
] | null | null | null | toolchain/osx/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/lib/hard/libstdc++.a-gdb.py | ChangsoonKim/STM32F7DiscTutor | 024e9e3b4d0e7c10f751b7e4ce95200815906794 | [
"MIT"
] | null | null | null | toolchain/osx/gcc-arm-none-eabi-6-2017-q1-update/arm-none-eabi/lib/hard/libstdc++.a-gdb.py | ChangsoonKim/STM32F7DiscTutor | 024e9e3b4d0e7c10f751b7e4ce95200815906794 | [
"MIT"
] | null | null | null | # -*- python -*-
# Copyright (C) 2009-2016 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later versio... | 41.193548 | 121 | 0.73101 |
import sys
import gdb
import os
import os.path
pythondir = '/tmp/jenkins-GCC-6-build_build-toolchain-mac-143_20170216_1487268977/install-native/share/gcc-arm-none-eabi'
libdir = '/tmp/jenkins-GCC-6-build_build-toolchain-mac-143_20170216_1487268977/install-native/arm-none-eabi/lib/hard'
# update sys.path; instead we... | true | true |
f75e7a8c7e29196b0b58c34c1b7ac9d41e013d6b | 5,374 | py | Python | CIS1_PA3/CIS1-PA3/KD_tree.py | JiaheXu/CIS | 01881beb8db270ecda917af07c2588ed66dddbc9 | [
"MIT"
] | null | null | null | CIS1_PA3/CIS1-PA3/KD_tree.py | JiaheXu/CIS | 01881beb8db270ecda917af07c2588ed66dddbc9 | [
"MIT"
] | null | null | null | CIS1_PA3/CIS1-PA3/KD_tree.py | JiaheXu/CIS | 01881beb8db270ecda917af07c2588ed66dddbc9 | [
"MIT"
] | null | null | null | import numpy as np
import sys, os
import time
import glob
from registration_3d import *
from cartesian import *
from collections import namedtuple
from operator import itemgetter
from pprint import pformat
import matplotlib.pyplot as plt
from read_files import *
import argparse
from ICPmatching import *
class KD_tree(... | 37.58042 | 101 | 0.592668 | import numpy as np
import sys, os
import time
import glob
from registration_3d import *
from cartesian import *
from collections import namedtuple
from operator import itemgetter
from pprint import pformat
import matplotlib.pyplot as plt
from read_files import *
import argparse
from ICPmatching import *
class KD_tree(... | true | true |
f75e7b513f6379579a79eb8b04c54398ab544a8e | 787 | py | Python | Basic Data Structures/linkedlist/leet_021_MergeTwoSortedLists.py | rush2catch/algorithms-leetcode | 38a5e6aa33d48fa14fe09c50c28a2eaabd736e55 | [
"MIT"
] | null | null | null | Basic Data Structures/linkedlist/leet_021_MergeTwoSortedLists.py | rush2catch/algorithms-leetcode | 38a5e6aa33d48fa14fe09c50c28a2eaabd736e55 | [
"MIT"
] | null | null | null | Basic Data Structures/linkedlist/leet_021_MergeTwoSortedLists.py | rush2catch/algorithms-leetcode | 38a5e6aa33d48fa14fe09c50c28a2eaabd736e55 | [
"MIT"
] | null | null | null | # Problem: Merge Two Sorted Lists
# Difficulty: Easy
# Category: LinkedList
# Leetcode 014: https://leetcode.com/problems/merge-two-sorted-lists/description/
# Description:
"""
Merge two sorted linked lists and return it as a new list.
The new list should be made by splicing together the nodes of the first two lists.
"... | 20.179487 | 82 | 0.655654 |
class Solution(object):
def mergeTwoLists(self, l1, l2):
head = curr = ListNode(0)
while l1 and l2:
if l1.val < l2.val:
curr.next = l1
l1 = l1.next
else:
curr.next = l2
l2 = l2.next
curr = curr.next
if l1.next == None:
curr.next = l2
else:
curr.next = l1
return head.next... | true | true |
f75e7d8ca24e41aeab639f4017c4b3843682dd79 | 250,096 | py | Python | python/ccxt/async_support/binance.py | JulesText/ccxt | e9209fa2f0a3f43ebb073248c04829f3f13b4830 | [
"MIT"
] | 2 | 2020-05-18T02:01:37.000Z | 2020-06-28T07:20:40.000Z | python/ccxt/async_support/binance.py | alimogh/ccxt | 518ea1a6d212605aa19deed74991bc525470e5c9 | [
"MIT"
] | null | null | null | python/ccxt/async_support/binance.py | alimogh/ccxt | 518ea1a6d212605aa19deed74991bc525470e5c9 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import A... | 48.290404 | 355 | 0.492811 |
from ccxt.async_support.base.exchange import Exchange
import json
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import PermissionDenied
from ccxt.base.errors import AccountSuspended
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.errors... | true | true |
f75e7e18a5b28f9407487b9f8c76d682fc58934e | 4,835 | py | Python | tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py | waitingkuo/tensorflow | ce3572a08b9ecfa5c8dd94921c2011f37b58e608 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py | waitingkuo/tensorflow | ce3572a08b9ecfa5c8dd94921c2011f37b58e608 | [
"Apache-2.0"
] | null | null | null | tensorflow/contrib/bayesflow/python/kernel_tests/variational_inference_test.py | waitingkuo/tensorflow | ce3572a08b9ecfa5c8dd94921c2011f37b58e608 | [
"Apache-2.0"
] | 1 | 2016-08-22T11:33:35.000Z | 2016-08-22T11:33:35.000Z | # Copyright 2016 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... | 36.08209 | 80 | 0.70817 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
sg = tf.contrib.bayesflow.stochastic_graph
vi = tf.contrib.bayesflow.variational_inference
distributions = tf.contrib.distributions
class NormalNoEntropy(distributions.Normal):
de... | true | true |
f75e7eeb447f3ee9e30cb123a7c020ad68366602 | 455 | py | Python | general/scoping.py | bpuderer/python-snippets | 3277b76b03f3ceb11e4571be4cecae68051aac45 | [
"MIT"
] | 1 | 2016-10-20T01:07:32.000Z | 2016-10-20T01:07:32.000Z | general/scoping.py | bpuderer/python-snippets | 3277b76b03f3ceb11e4571be4cecae68051aac45 | [
"MIT"
] | null | null | null | general/scoping.py | bpuderer/python-snippets | 3277b76b03f3ceb11e4571be4cecae68051aac45 | [
"MIT"
] | null | null | null | # LEGB rule: Local Enclosing Global Built-in
name = 'global'
def enclosing():
name = 'enclosing'
def local():
global name # bring name from global namespace into local
#nonlocal name # bring name from enclosing namespace into local
name = 'local'
print(f'enclosing name: ... | 22.75 | 72 | 0.628571 |
name = 'global'
def enclosing():
name = 'enclosing'
def local():
global name name = 'local'
print(f'enclosing name: {name}')
local()
print(f'enclosing name: {name}')
print(f'global name: {name}')
enclosing()
print(f'global name: {name}')
| true | true |
f75e7f2059069c9a7bc43d6a38aec7cf5410574b | 2,847 | py | Python | samples/cli/accelbyte_py_sdk_cli/social/_public_inc_user_stat_item.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | null | null | null | samples/cli/accelbyte_py_sdk_cli/social/_public_inc_user_stat_item.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | 1 | 2021-10-13T03:46:58.000Z | 2021-10-13T03:46:58.000Z | samples/cli/accelbyte_py_sdk_cli/social/_public_inc_user_stat_item.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | null | null | null | # Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template_file: python-cli-command.j2
# justice-social-service (1.29.2)
# pylint: disable=duplicate-code... | 33.104651 | 103 | 0.725325 |
import json
import yaml
from typing import Optional
import click
from .._utils import login_as as login_as_internal
from .._utils import to_dict
from accelbyte_py_sdk.api.social import public_inc_user_stat_item as public_inc_user_stat_item_internal
from accelbyte_py_sdk.api.social.models import ErrorEntity
from a... | true | true |
f75e7f984ce4892754c98d709f9d61329900cbcb | 162 | py | Python | monitoring/utils/logger.py | bruno-sartori/skill-monitoring | 18017d0abb43ee399b66012fb256b27bcf76a8ae | [
"Apache-2.0"
] | null | null | null | monitoring/utils/logger.py | bruno-sartori/skill-monitoring | 18017d0abb43ee399b66012fb256b27bcf76a8ae | [
"Apache-2.0"
] | null | null | null | monitoring/utils/logger.py | bruno-sartori/skill-monitoring | 18017d0abb43ee399b66012fb256b27bcf76a8ae | [
"Apache-2.0"
] | null | null | null |
class LOG:
def info(message):
print("Info: " + message)
def error(message):
print("Error: " + message)
def debug(message):
print("Debug: " + message)
| 14.727273 | 28 | 0.62963 |
class LOG:
def info(message):
print("Info: " + message)
def error(message):
print("Error: " + message)
def debug(message):
print("Debug: " + message)
| true | true |
f75e7fab31eda017e9f25b4b2a9c341ed04fc82b | 1,734 | py | Python | python-client/setup.py | iamchenchen/study-appium | 567de5994029e519e2cd1ebcfd29dea16d19f6f6 | [
"Apache-2.0"
] | 4 | 2015-11-16T00:54:33.000Z | 2016-06-20T14:53:39.000Z | python-client/setup.py | iamchenchen/study-appium | 567de5994029e519e2cd1ebcfd29dea16d19f6f6 | [
"Apache-2.0"
] | null | null | null | python-client/setup.py | iamchenchen/study-appium | 567de5994029e519e2cd1ebcfd29dea16d19f6f6 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# 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... | 31.527273 | 74 | 0.638408 |
from distutils.core import setup
from setuptools import setup
setup(
name='Appium-Python-Client',
version='0.17',
description='Python client for Appium 1.4',
keywords=[
'appium',
'appium 1.0',
'selenium',
'selenium 3',
'python client',
'mobile automatio... | true | true |
f75e803681a1367a5aa0dd638acfbf92aa53bf57 | 288 | py | Python | Homeworks/Homework7/PyLinkAnalysis/gizmodo/gizmodo/pipelines.py | RashmiPurvachar/big-data-python-class | 172ed73353d4951df21c338f1ded57a1ca7d1c00 | [
"MIT"
] | null | null | null | Homeworks/Homework7/PyLinkAnalysis/gizmodo/gizmodo/pipelines.py | RashmiPurvachar/big-data-python-class | 172ed73353d4951df21c338f1ded57a1ca7d1c00 | [
"MIT"
] | null | null | null | Homeworks/Homework7/PyLinkAnalysis/gizmodo/gizmodo/pipelines.py | RashmiPurvachar/big-data-python-class | 172ed73353d4951df21c338f1ded57a1ca7d1c00 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class GizmodoPipeline(object):
def process_item(self, item, spider):
return item
| 24 | 65 | 0.711806 |
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class GizmodoPipeline(object):
def process_item(self, item, spider):
return item
| true | true |
f75e80b1eb3f02e6c63ef516ca10a7dd3084f954 | 1,888 | py | Python | setup.py | dallyhorton/dbt-spark | 0ab490b8be32e127851590395f67582d8c86f401 | [
"Apache-2.0"
] | null | null | null | setup.py | dallyhorton/dbt-spark | 0ab490b8be32e127851590395f67582d8c86f401 | [
"Apache-2.0"
] | null | null | null | setup.py | dallyhorton/dbt-spark | 0ab490b8be32e127851590395f67582d8c86f401 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from setuptools import find_namespace_packages, setup
import os
import re
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md')) as f:
long_description = f.read()
package_name = "dbt-spark"
# get this from a separate file
def _dbt... | 28.179104 | 79 | 0.654661 | from setuptools import find_namespace_packages, setup
import os
import re
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md')) as f:
long_description = f.read()
package_name = "dbt-spark"
def _dbt_spark_version():
_version_path = os.path.join(
... | true | true |
f75e81db137969c2b6f473a56e5a12f756140c79 | 52 | py | Python | logbook_cli/__main__.py | saadmk11/logbook-cli | 8bab1daf79502e793fe75c7a17ce30d698bcf0f5 | [
"MIT"
] | 4 | 2021-05-15T02:44:08.000Z | 2022-02-03T23:03:17.000Z | logbook_cli/__main__.py | saadmk11/logbook-cli | 8bab1daf79502e793fe75c7a17ce30d698bcf0f5 | [
"MIT"
] | null | null | null | logbook_cli/__main__.py | saadmk11/logbook-cli | 8bab1daf79502e793fe75c7a17ce30d698bcf0f5 | [
"MIT"
] | null | null | null | from .cli import app
app(prog_name="logbook-cli")
| 10.4 | 28 | 0.730769 | from .cli import app
app(prog_name="logbook-cli")
| true | true |
f75e82199fa58371c50ab5a32cdf1e6669651c40 | 9,459 | py | Python | tests/integ/test_tf_script_mode.py | iyerr3/sagemaker-python-sdk | cfaa2c6aabb3860e722bf68b27e0f9c3b8fc5570 | [
"Apache-2.0"
] | null | null | null | tests/integ/test_tf_script_mode.py | iyerr3/sagemaker-python-sdk | cfaa2c6aabb3860e722bf68b27e0f9c3b8fc5570 | [
"Apache-2.0"
] | null | null | null | tests/integ/test_tf_script_mode.py | iyerr3/sagemaker-python-sdk | cfaa2c6aabb3860e722bf68b27e0f9c3b8fc5570 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017-2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 37.685259 | 99 | 0.714452 | from __future__ import absolute_import
import numpy as np
import os
import time
import pytest
import boto3
from sagemaker.tensorflow import TensorFlow
from six.moves.urllib.parse import urlparse
from sagemaker.utils import unique_name_from_base
import tests.integ
from tests.integ import timeout
ROLE = "SageMakerRo... | true | true |
f75e82e15850a7108117ef2c52941e556768d7de | 735 | py | Python | venv/Exercises/ex036.py | jonassignoreti/Python-CursoemVideo | 24f5932bed2fe98308321be7dd9326e65a942d4b | [
"MIT"
] | null | null | null | venv/Exercises/ex036.py | jonassignoreti/Python-CursoemVideo | 24f5932bed2fe98308321be7dd9326e65a942d4b | [
"MIT"
] | null | null | null | venv/Exercises/ex036.py | jonassignoreti/Python-CursoemVideo | 24f5932bed2fe98308321be7dd9326e65a942d4b | [
"MIT"
] | null | null | null | '''Escreva um programa para aprovar o empréstimo bancário para a compra de uma casa.
O Programa vai perguntar o valor da casa, o salário do comprador e em quantos anos ele vai pagar.
Calcule o valor da prestação mensal, sabendo que ela não pode exceder 30% do salário ou então o empréstimo será negado'''
valor = float(i... | 49 | 121 | 0.718367 | valor = float(input('Qual é o valor do imóvel?: R$'))
salario = float(input('Quanto é o salário do comprador?: R$'))
anos = int(input('Em quantos anos será pago?: '))
meses = anos * 12
prestacao = valor / meses
if prestacao <= (salario * 30/100):
print('\033[34mEmpréstimo Aprovado!\033[m')
print('Será pago em ... | true | true |
f75e84d8723d61d511e3ecb6459be1d701444211 | 29,551 | py | Python | research/object_detection/protos/optimizer_pb2.py | AaradhyaSaxena/tensorflow-models | 1a4e3c8bc95e001e481115330a9d97620c2ff6b4 | [
"Apache-2.0"
] | null | null | null | research/object_detection/protos/optimizer_pb2.py | AaradhyaSaxena/tensorflow-models | 1a4e3c8bc95e001e481115330a9d97620c2ff6b4 | [
"Apache-2.0"
] | null | null | null | research/object_detection/protos/optimizer_pb2.py | AaradhyaSaxena/tensorflow-models | 1a4e3c8bc95e001e481115330a9d97620c2ff6b4 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: object_detection/protos/optimizer.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messag... | 46.537008 | 3,028 | 0.775507 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _s... | true | true |
f75e85b6be66063f5f251a3924187e4cef4564ab | 9,192 | py | Python | scripts/install/PiirBlaster_install.py | Electronya/PirBlaster | 804b86b2699183c40f2157cba0e151bec9d4725a | [
"MIT"
] | 1 | 2020-11-02T09:37:43.000Z | 2020-11-02T09:37:43.000Z | scripts/install/PiirBlaster_install.py | Electronya/PirBlasterBackend | 804b86b2699183c40f2157cba0e151bec9d4725a | [
"MIT"
] | 1 | 2021-06-26T14:56:31.000Z | 2021-06-26T14:56:31.000Z | scripts/install/PiirBlaster_install.py | Electronya/PirBlasterBackend | 804b86b2699183c40f2157cba0e151bec9d4725a | [
"MIT"
] | 1 | 2020-11-02T09:34:33.000Z | 2020-11-02T09:34:33.000Z | #!/usr/bin/env python3
import os
import subprocess
import json
# Text styling class
class Text:
HEADER = '\033[1;34m'
SUCCESS = '\033[1;32m'
FAIL = '\033[1;21m'
ENDC = '\033[0m'
# Shell commands class
class Commands:
INSTALL_PY_DEPS = 'sudo apt-get install -y python3 python3-distutils python3-pip ... | 40.139738 | 149 | 0.698542 | import os
import subprocess
import json
class Text:
HEADER = '\033[1;34m'
SUCCESS = '\033[1;32m'
FAIL = '\033[1;21m'
ENDC = '\033[0m'
class Commands:
INSTALL_PY_DEPS = 'sudo apt-get install -y python3 python3-distutils python3-pip python3-setuptools python3-venv'
CLONE_PIIRBLASTER = 'git clone... | true | true |
f75e865a21ec37ef5fb466e904f8ec3e5d8e553e | 36,822 | py | Python | socketcanopen/object_dictionary.py | graynet-dev/canopen-rpi | f5474aa5315fb3ed619223c456dadc14f7215381 | [
"MIT"
] | 1 | 2021-02-24T18:02:39.000Z | 2021-02-24T18:02:39.000Z | socketcanopen/object_dictionary.py | graynet-dev/canopen-rpi | f5474aa5315fb3ed619223c456dadc14f7215381 | [
"MIT"
] | null | null | null | socketcanopen/object_dictionary.py | graynet-dev/canopen-rpi | f5474aa5315fb3ed619223c456dadc14f7215381 | [
"MIT"
] | null | null | null | from collections import Mapping, MutableMapping
from configparser import ConfigParser
import datetime
from enum import Enum, IntEnum, unique
import struct
from threading import Lock
from .constants import *
class ObjectDictionary(MutableMapping):
def __init__(self, other=None, **kwargs):
self._store = { ... | 42.568786 | 154 | 0.56488 | from collections import Mapping, MutableMapping
from configparser import ConfigParser
import datetime
from enum import Enum, IntEnum, unique
import struct
from threading import Lock
from .constants import *
class ObjectDictionary(MutableMapping):
def __init__(self, other=None, **kwargs):
self._store = { ... | true | true |
f75e867a66f040b1d369a1e27c12ecde8bd53c7c | 236 | py | Python | module/math_test.py | huncut2016/bazel_pybind_test | 2fc87d4b728d8c1b56450c7927e7f988f9b4c22b | [
"Apache-2.0"
] | null | null | null | module/math_test.py | huncut2016/bazel_pybind_test | 2fc87d4b728d8c1b56450c7927e7f988f9b4c22b | [
"Apache-2.0"
] | null | null | null | module/math_test.py | huncut2016/bazel_pybind_test | 2fc87d4b728d8c1b56450c7927e7f988f9b4c22b | [
"Apache-2.0"
] | null | null | null | # from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
import sys
print(sys.version)
from module import t_math
assert t_math.add(1, 1) == 2
assert t_math.subtract(1, 1) == 0
| 21.454545 | 40 | 0.779661 | import sys
print(sys.version)
from module import t_math
assert t_math.add(1, 1) == 2
assert t_math.subtract(1, 1) == 0
| true | true |
f75e86ed72524489a4dedb0a9ced3ae13b28275f | 33,486 | py | Python | tests/custom_cluster/test_permanent_udfs.py | wzhou-code/impala | 217d821e94cc8571c7f21e8a4d55a3d3f900c116 | [
"Apache-2.0"
] | 746 | 2017-12-02T06:02:05.000Z | 2022-03-29T06:59:03.000Z | tests/custom_cluster/test_permanent_udfs.py | wzhou-code/impala | 217d821e94cc8571c7f21e8a4d55a3d3f900c116 | [
"Apache-2.0"
] | 9 | 2018-01-30T16:16:22.000Z | 2021-08-31T00:13:28.000Z | tests/custom_cluster/test_permanent_udfs.py | vihangk1/impala | ed0521e346f765577a86747bd8472e8622781759 | [
"Apache-2.0"
] | 363 | 2017-12-10T01:08:17.000Z | 2022-03-26T05:25:00.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... | 47.565341 | 107 | 0.723795 |
import glob
import os
import pytest
import re
import shutil
import subprocess
from tempfile import mkdtemp
from tests.common.custom_cluster_test_suite import CustomClusterTestSuite
from tests.common.skip import (SkipIfS3, SkipIfABFS, SkipIfADLS, SkipIfIsilon, SkipIfGCS,
SkipIfLocal)
fro... | true | true |
f75e88f3ba3b273432118a8acc8623d79b50eda7 | 90 | py | Python | Python Pattern Programs/Alphabetic Patterns/Pattern 1 Alternative.py | trial1user/Printing-Pattern-Programs | dde29e056b8e067fb3a824edb7ecb7dd9c9a776a | [
"MIT"
] | null | null | null | Python Pattern Programs/Alphabetic Patterns/Pattern 1 Alternative.py | trial1user/Printing-Pattern-Programs | dde29e056b8e067fb3a824edb7ecb7dd9c9a776a | [
"MIT"
] | null | null | null | Python Pattern Programs/Alphabetic Patterns/Pattern 1 Alternative.py | trial1user/Printing-Pattern-Programs | dde29e056b8e067fb3a824edb7ecb7dd9c9a776a | [
"MIT"
] | null | null | null | #Alternative
for x in 'ABCDE':
for y in 'ABCDE':
print(x,end="")
print()
| 12.857143 | 23 | 0.522222 | for x in 'ABCDE':
for y in 'ABCDE':
print(x,end="")
print()
| true | true |
f75e8981ceac1313988f6fcee9bbd2c862bfa2b4 | 789 | py | Python | automate/server/user/forms.py | JeromeErasmus/browserstack_automate | d6616264a7983ae3683229d7591cf0b50e21871f | [
"Apache-2.0"
] | null | null | null | automate/server/user/forms.py | JeromeErasmus/browserstack_automate | d6616264a7983ae3683229d7591cf0b50e21871f | [
"Apache-2.0"
] | null | null | null | automate/server/user/forms.py | JeromeErasmus/browserstack_automate | d6616264a7983ae3683229d7591cf0b50e21871f | [
"Apache-2.0"
] | null | null | null | # automate/server/user/forms.py
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, Length, EqualTo
class LoginForm(Form):
email = StringField('Email Address', [DataRequired(), Email()])
password = PasswordField('Password', [DataRequi... | 27.206897 | 80 | 0.652725 |
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, Length, EqualTo
class LoginForm(Form):
email = StringField('Email Address', [DataRequired(), Email()])
password = PasswordField('Password', [DataRequired()])
class RegisterForm(For... | true | true |
f75e89f8fb4c36d728418c7e76bb69f1ac3094ea | 34,579 | py | Python | macauff/tests/test_perturbation_auf.py | lsst-uk/macauff | 02ce5caeaa1523957f914155dd433c7d1bf65869 | [
"BSD-3-Clause"
] | null | null | null | macauff/tests/test_perturbation_auf.py | lsst-uk/macauff | 02ce5caeaa1523957f914155dd433c7d1bf65869 | [
"BSD-3-Clause"
] | null | null | null | macauff/tests/test_perturbation_auf.py | lsst-uk/macauff | 02ce5caeaa1523957f914155dd433c7d1bf65869 | [
"BSD-3-Clause"
] | 1 | 2022-01-24T13:21:37.000Z | 2022-01-24T13:21:37.000Z | # Licensed under a 3-clause BSD style license - see LICENSE
'''
Tests for the "perturbation_auf" module.
'''
import pytest
import os
import numpy as np
from numpy.testing import assert_allclose
from scipy.special import j0, j1
from ..matching import CrossMatch
from ..misc_functions_fortran import misc_functions_fortr... | 52.313162 | 99 | 0.578704 |
import pytest
import os
import numpy as np
from numpy.testing import assert_allclose
from scipy.special import j0, j1
from ..matching import CrossMatch
from ..misc_functions_fortran import misc_functions_fortran as mff
from ..perturbation_auf import (make_perturb_aufs, download_trilegal_simulation)
from ..perturbatio... | true | true |
f75e89fb5627353e7c890071976e75995f695c3a | 4,906 | py | Python | tests/test_for_support/test_for_matrix.py | carrascomj/memote | 81a55a163262a0e06bfcb036d98e8e551edc3873 | [
"Apache-2.0"
] | 85 | 2017-10-17T14:14:52.000Z | 2022-03-14T19:33:02.000Z | tests/test_for_support/test_for_matrix.py | carrascomj/memote | 81a55a163262a0e06bfcb036d98e8e551edc3873 | [
"Apache-2.0"
] | 609 | 2017-08-09T15:30:06.000Z | 2022-03-28T12:17:32.000Z | tests/test_for_support/test_for_matrix.py | carrascomj/memote | 81a55a163262a0e06bfcb036d98e8e551edc3873 | [
"Apache-2.0"
] | 22 | 2017-09-27T08:47:17.000Z | 2022-02-15T11:23:13.000Z | # -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# 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... | 31.448718 | 74 | 0.67285 |
from __future__ import absolute_import
import pytest
from cobra import Metabolite, Reaction
import memote.support.matrix as matrix
from memote.utils import register_with
MODEL_REGISTRY = dict()
@register_with(MODEL_REGISTRY)
def three_components_closed(base):
met_a = Metabolite("A")
met_b = Metabolite(... | true | true |
f75e8b4073481538420c7da807bb819408b81c1d | 11,280 | py | Python | tests/fullscale/viscoelasticity/nofaults-3d/axialstrainrate_genmaxwell_soln.py | cehanagan/pylith | cf5c1c34040460a82f79b6eb54df894ed1b1ee93 | [
"MIT"
] | 93 | 2015-01-08T16:41:22.000Z | 2022-02-25T13:40:02.000Z | tests/fullscale/viscoelasticity/nofaults-3d/axialstrainrate_genmaxwell_soln.py | sloppyjuicy/pylith | ac2c1587f87e45c948638b19560813d4d5b6a9e3 | [
"MIT"
] | 277 | 2015-02-20T16:27:35.000Z | 2022-03-30T21:13:09.000Z | tests/fullscale/viscoelasticity/nofaults-3d/axialstrainrate_genmaxwell_soln.py | sloppyjuicy/pylith | ac2c1587f87e45c948638b19560813d4d5b6a9e3 | [
"MIT"
] | 71 | 2015-03-24T12:11:08.000Z | 2022-03-03T04:26:02.000Z | # ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University at Buffalo
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copy... | 35.031056 | 101 | 0.601064 |
import numpy
import math
from pythia.pyre.units.time import year
p_density = 2500.0
p_vs = 3464.1016
p_vp = 6000.0
p_viscosity_1 = 9.46728e17
p_viscosity_2 = 4.73364e17
p_viscosity_3 = 1.893456e18
p_shear_ratio_1 = 0.25
p_shear_ratio_2 = 0.25
p_shear_ratio_3 = 0.25
numMaxElements = 3
numComponents = 6
U0 = 1.0
V0 =... | true | true |
f75e8cfe866bb4e958a39bfafbe2f2c03b1559da | 14,427 | py | Python | examples/object_storage/object_storage_bulk_rename.py | ezequielramos/oci-python-sdk | cc4235cf217beaf9feed75760e9ce82610222762 | [
"Apache-2.0",
"BSD-3-Clause"
] | 249 | 2017-09-11T22:06:05.000Z | 2022-03-04T17:09:29.000Z | examples/object_storage/object_storage_bulk_rename.py | ezequielramos/oci-python-sdk | cc4235cf217beaf9feed75760e9ce82610222762 | [
"Apache-2.0",
"BSD-3-Clause"
] | 228 | 2017-09-11T23:07:26.000Z | 2022-03-23T10:58:50.000Z | examples/object_storage/object_storage_bulk_rename.py | ezequielramos/oci-python-sdk | cc4235cf217beaf9feed75760e9ce82610222762 | [
"Apache-2.0",
"BSD-3-Clause"
] | 224 | 2017-09-27T07:32:43.000Z | 2022-03-25T16:55:42.000Z | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 37.767016 | 245 | 0.574548 |
import threading
import time
import queue
import oci
import argparse
import datetime
import sys
import os
parser = argparse.ArgumentParser()
parser.add_argument('-t', default="", dest='config_profile', help='Config file section to use (tenancy profile)')
parser.add_argument('-p', default="", dest='proxy', help='Set... | true | true |
f75e8dfa2744878f516cb00f5828a3f5996a7b6e | 2,067 | py | Python | 2019/day_10.py | nabiirah/advent-of-code | 9c7e7cae437c024aa05d9cb7f9211fd47f5226a2 | [
"MIT"
] | 24 | 2020-12-08T20:07:52.000Z | 2022-01-18T20:08:06.000Z | 2019/day_10.py | nestorhf/advent-of-code | 1bb827e9ea85e03e0720e339d10b3ed8c44d8f27 | [
"MIT"
] | null | null | null | 2019/day_10.py | nestorhf/advent-of-code | 1bb827e9ea85e03e0720e339d10b3ed8c44d8f27 | [
"MIT"
] | 10 | 2020-12-04T10:04:15.000Z | 2022-02-21T22:22:26.000Z | """Advent of Code 2019 Day 10 - Monitoring Station."""
from math import atan2, degrees, pi
with open("inputs/day_10.txt", "r") as f:
space = [list(row) for row in f.read().strip().split('\n')]
space_dict = {}
y = 0
for row in space:
x = 0
for col in row:
value = space[y][x]
if value == ... | 26.844156 | 75 | 0.618771 |
from math import atan2, degrees, pi
with open("inputs/day_10.txt", "r") as f:
space = [list(row) for row in f.read().strip().split('\n')]
space_dict = {}
y = 0
for row in space:
x = 0
for col in row:
value = space[y][x]
if value == '#':
space_dict[(x, y)] = space[y][x]
... | true | true |
f75e8f7064637758e7d934cd8a49d77dd98e4b9a | 300 | py | Python | openaps/vendors/plugins/remove.py | jiapei100/openaps | d8e5878327ff34a41807ed0d94d782c47c28c1ee | [
"MIT"
] | null | null | null | openaps/vendors/plugins/remove.py | jiapei100/openaps | d8e5878327ff34a41807ed0d94d782c47c28c1ee | [
"MIT"
] | null | null | null | openaps/vendors/plugins/remove.py | jiapei100/openaps | d8e5878327ff34a41807ed0d94d782c47c28c1ee | [
"MIT"
] | null | null | null |
"""
Remove vendor plugin from openaps-environment
"""
from vendor import Vendor
def main (args, app):
for plugin in Vendor.FromConfig(app.config):
if args.name == plugin.name:
plugin.remove(app.config)
app.config.save( )
print ('removed', plugin.format_url( ))
break
| 20 | 46 | 0.663333 |
from vendor import Vendor
def main (args, app):
for plugin in Vendor.FromConfig(app.config):
if args.name == plugin.name:
plugin.remove(app.config)
app.config.save( )
print ('removed', plugin.format_url( ))
break
| true | true |
f75e8fdcc66c14490f798dd425bea4c62d6361cb | 11,137 | py | Python | bf1/config/weapons.py | Girbons/battlefield1-stats | 18bec6995e4c3205a4141962c083e40c2f47a954 | [
"MIT"
] | 6 | 2017-08-11T03:24:19.000Z | 2021-09-17T00:46:48.000Z | bf1/config/weapons.py | Girbons/battlefield1-stats | 18bec6995e4c3205a4141962c083e40c2f47a954 | [
"MIT"
] | 16 | 2017-04-07T19:47:52.000Z | 2019-09-08T10:42:37.000Z | bf1/config/weapons.py | Girbons/battlefield1-stats | 18bec6995e4c3205a4141962c083e40c2f47a954 | [
"MIT"
] | 7 | 2017-10-14T15:06:59.000Z | 2021-05-11T01:18:50.000Z | WEAPONS = {
"lewis gun low weight": "b79b965e-e080-475d-a1cc-2432de5f3bf5",
"sawtooth knife": "f9983578-e3e9-46fb-bcc5-6640825b7169",
"sjogren inertial factory": "5d89166e-58e1-46fd-b854-69641e9dcef7",
"survival knife": "5be36f02-de5e-4ddd-8e09-74fd16f39efc",
"m97 trench gun backbored": "ea7c6cf1-58... | 62.920904 | 76 | 0.722906 | WEAPONS = {
"lewis gun low weight": "b79b965e-e080-475d-a1cc-2432de5f3bf5",
"sawtooth knife": "f9983578-e3e9-46fb-bcc5-6640825b7169",
"sjogren inertial factory": "5d89166e-58e1-46fd-b854-69641e9dcef7",
"survival knife": "5be36f02-de5e-4ddd-8e09-74fd16f39efc",
"m97 trench gun backbored": "ea7c6cf1-58... | true | true |
f75e9101a08e5e6ea8785eb222e080eeb9033012 | 2,532 | py | Python | shaker/cli.py | benjaminws/shaker | d9195422b8bef64bc751fffee8706f1abbd656a3 | [
"BSD-2-Clause"
] | 1 | 2015-11-05T10:28:03.000Z | 2015-11-05T10:28:03.000Z | shaker/cli.py | benjaminws/shaker | d9195422b8bef64bc751fffee8706f1abbd656a3 | [
"BSD-2-Clause"
] | null | null | null | shaker/cli.py | benjaminws/shaker | d9195422b8bef64bc751fffee8706f1abbd656a3 | [
"BSD-2-Clause"
] | null | null | null | from shaker.version import __version__
import optparse
def parse_cli():
parser = optparse.OptionParser(
usage="%prog [options] profile",
version="%%prog %s" % __version__)
parser.add_option(
'-a', '--ami', dest='ec2_ami_id', metavar='AMI',
help='Build instance from AMI')
p... | 35.166667 | 75 | 0.593602 | from shaker.version import __version__
import optparse
def parse_cli():
parser = optparse.OptionParser(
usage="%prog [options] profile",
version="%%prog %s" % __version__)
parser.add_option(
'-a', '--ami', dest='ec2_ami_id', metavar='AMI',
help='Build instance from AMI')
p... | false | true |
f75e913f2f18bea868c970adb92587c4c6ae7daf | 9,760 | py | Python | cogs/truth_or_dare_cmd.py | RadioactiveRainCloud/discord-bot | 60cfc3db4861a42846797cce14a998d1f491614b | [
"Unlicense"
] | null | null | null | cogs/truth_or_dare_cmd.py | RadioactiveRainCloud/discord-bot | 60cfc3db4861a42846797cce14a998d1f491614b | [
"Unlicense"
] | 3 | 2020-10-15T02:35:40.000Z | 2020-10-22T11:24:43.000Z | cogs/truth_or_dare_cmd.py | RadioactiveRainCloud/discord-bot | 60cfc3db4861a42846797cce14a998d1f491614b | [
"Unlicense"
] | 3 | 2020-10-14T11:52:52.000Z | 2021-05-12T13:13:40.000Z | import discord
from discord.ext import commands
from random import shuffle
GAME_MASTER = {}
def is_game_master(ctx):
return ctx.message.author.id == GAME_MASTER.get(ctx.guild.id)
class TruthOrDareCmd(commands.Cog):
""" Command list for playing a Truth or Dare game with server members. """
def __init__... | 38.125 | 80 | 0.573975 | import discord
from discord.ext import commands
from random import shuffle
GAME_MASTER = {}
def is_game_master(ctx):
return ctx.message.author.id == GAME_MASTER.get(ctx.guild.id)
class TruthOrDareCmd(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.players = {}
self.reve... | true | true |
f75e917c180db606493c1b45893d9446c7fd8dc0 | 99,336 | py | Python | speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py | munkhuushmgl/google-cloud-python | 6bd28e7fa72a32c73434f5cac9efcb5153a9ed9e | [
"Apache-2.0"
] | 1 | 2019-10-11T03:01:44.000Z | 2019-10-11T03:01:44.000Z | speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py | munkhuushmgl/google-cloud-python | 6bd28e7fa72a32c73434f5cac9efcb5153a9ed9e | [
"Apache-2.0"
] | 6 | 2019-05-27T22:05:58.000Z | 2019-08-05T16:46:16.000Z | speech/google/cloud/speech_v1/proto/cloud_speech_pb2.py | munkhuushmgl/google-cloud-python | 6bd28e7fa72a32c73434f5cac9efcb5153a9ed9e | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/speech_v1/proto/cloud_speech.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import mes... | 37.943468 | 7,405 | 0.646301 |
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym... | true | true |
f75e91de0c0944e4bd9bc712d51f90345f9c4f33 | 765 | py | Python | cdhit_parser_copy.py | fandemonium/code | 4498f97658c146de8e693776e05bedeaaf2d5a1d | [
"MIT"
] | 2 | 2017-12-25T09:14:52.000Z | 2021-05-18T06:39:26.000Z | cdhit_parser_copy.py | fandemonium/code | 4498f97658c146de8e693776e05bedeaaf2d5a1d | [
"MIT"
] | 1 | 2018-09-29T22:34:30.000Z | 2018-09-29T22:34:30.000Z | cdhit_parser_copy.py | fandemonium/code | 4498f97658c146de8e693776e05bedeaaf2d5a1d | [
"MIT"
] | 1 | 2015-01-30T20:29:25.000Z | 2015-01-30T20:29:25.000Z | #!/usr/bin/python
##?? early version of count_clst_abundance.py ??##
import sys
import os
from collections import Counter
import re
#if len(sys.argv) != 4:
# print "USAGE: cdhit_clst_parser.py <pattern> <cdhit.clstr> <out_file>"
# sys.exit(1)
j =0
f = open(sys.argv[1], 'rU')
#output = open(sys.argv[2], 'w')
for n... | 19.615385 | 72 | 0.603922 |
import sys
import os
from collections import Counter
import re
j =0
f = open(sys.argv[1], 'rU')
for n, line in enumerate(f):
line = line.rstrip()
if line.startswith(">Cluster"):
string = re.split("\n", line)
id = string[0]
if j == 0:
print(id);
else:
print("contig_count=",j)
print(id);
if line... | true | true |
f75e92585b5e8c0966023fc21976eb48aa739080 | 9,687 | py | Python | pythondata_cpu_minerva/sources/minerva/test/test_units_divider.py | litex-hub/pythondata-cpu-minerva | ef714b6fd68b73e71a26a71efa45c6d148ad9379 | [
"BSD-2-Clause"
] | null | null | null | pythondata_cpu_minerva/sources/minerva/test/test_units_divider.py | litex-hub/pythondata-cpu-minerva | ef714b6fd68b73e71a26a71efa45c6d148ad9379 | [
"BSD-2-Clause"
] | null | null | null | pythondata_cpu_minerva/sources/minerva/test/test_units_divider.py | litex-hub/pythondata-cpu-minerva | ef714b6fd68b73e71a26a71efa45c6d148ad9379 | [
"BSD-2-Clause"
] | null | null | null | import unittest
from amaranth import *
from amaranth.back.pysim import *
from ..units.divider import *
from ..isa import Funct3
def test_op(funct3, src1, src2, result):
def test(self):
sim = Simulator(self.dut)
def process():
yield self.dut.x_op.eq(funct3)
yield self.dut.... | 58.709091 | 83 | 0.723031 | import unittest
from amaranth import *
from amaranth.back.pysim import *
from ..units.divider import *
from ..isa import Funct3
def test_op(funct3, src1, src2, result):
def test(self):
sim = Simulator(self.dut)
def process():
yield self.dut.x_op.eq(funct3)
yield self.dut.... | true | true |
f75e93025e0412d54dc52c859b66ed52d50ff310 | 1,044 | py | Python | piicatcher/__init__.py | argos-education/piicatcher | 7370cad8a4938762311926e8ab3bc286232e7106 | [
"Apache-2.0"
] | 4 | 2019-07-10T08:52:56.000Z | 2019-10-23T13:58:18.000Z | piicatcher/__init__.py | argos-education/piicatcher | 7370cad8a4938762311926e8ab3bc286232e7106 | [
"Apache-2.0"
] | 11 | 2019-03-21T11:28:07.000Z | 2019-08-30T12:13:28.000Z | piicatcher/__init__.py | argos-education/piicatcher | 7370cad8a4938762311926e8ab3bc286232e7106 | [
"Apache-2.0"
] | 2 | 2019-03-21T11:06:49.000Z | 2019-03-27T06:05:52.000Z | # flake8: noqa
__version__ = "0.19.2"
from dbcat.catalog.pii_types import PiiType
class Phone(PiiType):
name = "Phone"
type = "phone"
pass
class Email(PiiType):
name = "Email"
type = "email"
pass
class CreditCard(PiiType, type="credit_card"): # type: ignore
name = "Credit Card"
t... | 14.704225 | 62 | 0.609195 | __version__ = "0.19.2"
from dbcat.catalog.pii_types import PiiType
class Phone(PiiType):
name = "Phone"
type = "phone"
pass
class Email(PiiType):
name = "Email"
type = "email"
pass
class CreditCard(PiiType, type="credit_card"): name = "Credit Card"
type = "credit_card"
pass
... | true | true |
f75e939e5780c197fb5d84684703066540299742 | 191 | py | Python | seed/app/graphene.py | erick-rivas/django-reference | 3195de635419a0c2ac8eee92742bb98365f614d8 | [
"MIT"
] | null | null | null | seed/app/graphene.py | erick-rivas/django-reference | 3195de635419a0c2ac8eee92742bb98365f614d8 | [
"MIT"
] | 11 | 2020-02-11T23:57:45.000Z | 2022-02-17T07:03:39.000Z | seed/app/graphene.py | erick-rivas/django-reference | 3195de635419a0c2ac8eee92742bb98365f614d8 | [
"MIT"
] | null | null | null | """
__Seed builder__
AUTO_GENERATED (Read only)
Modify via builder
"""
def get_schema():
import seed.schema.schema as seed_schema
return seed_schema.schema
schema = get_schema() | 17.363636 | 44 | 0.732984 |
def get_schema():
import seed.schema.schema as seed_schema
return seed_schema.schema
schema = get_schema() | true | true |
f75e9555993063b9a6f9184b90a11f7153217062 | 3,148 | py | Python | monitor_server/api/pipelines.py | CFMTech/monitor-server-api | 51b927ae929ffec46c06a6d248969f6343ab5241 | [
"MIT"
] | 3 | 2021-06-16T07:05:39.000Z | 2021-06-16T18:48:04.000Z | monitor_server/api/pipelines.py | CFMTech/monitor-server-api | 51b927ae929ffec46c06a6d248969f6343ab5241 | [
"MIT"
] | 2 | 2021-10-15T21:35:55.000Z | 2021-10-19T11:16:58.000Z | monitor_server/api/pipelines.py | CFMTech/monitor-server-api | 51b927ae929ffec46c06a6d248969f6343ab5241 | [
"MIT"
] | null | null | null | # SPDX-FileCopyrightText: 2021 Jean-Sébastien Dieu <jean-sebastien.dieu@cfm.fr>
#
# SPDX-License-Identifier: MIT
from flask import request
from flask_restx import Resource
from sqlalchemy import func
from http import HTTPStatus
from monitor_server import SERVER
from monitor_server.api.model import (pipelines_ns as n... | 40.883117 | 102 | 0.694727 |
from flask import request
from flask_restx import Resource
from sqlalchemy import func
from http import HTTPStatus
from monitor_server import SERVER
from monitor_server.api.model import (pipelines_ns as ns, pipeline_list_model, pipeline_builds_model,
pipeline_build_sessions_mode... | true | true |
f75e95b9575f876696f76cfd6261e0604748ee7f | 15,888 | py | Python | EPI-ClusT.py | sclipman/TransmissionCluster2 | 3dbe4c23bc0ae0489e2686d915615bbb32631f4d | [
"MIT"
] | 2 | 2019-07-30T17:08:03.000Z | 2019-08-20T16:51:36.000Z | EPI-ClusT.py | sclipman/TransmissionCluster2 | 3dbe4c23bc0ae0489e2686d915615bbb32631f4d | [
"MIT"
] | null | null | null | EPI-ClusT.py | sclipman/TransmissionCluster2 | 3dbe4c23bc0ae0489e2686d915615bbb32631f4d | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
###############################################################################
# Program: EPI-ClusT.py
# Type: Python Script
# Version: 1.0
# Author: Steven J. Clipman
# Description: Empiral Phylogeny Informed Cluster Tool for identifying
# distance thresholds and defining clusters... | 41.920844 | 305 | 0.583082 |
from queue import Queue
from treeswift import read_tree_newick
import PySimpleGUI as sg
import os
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import math
import statistics
import numpy
NUM_THRESH = 1000
def cut(node):
cluster = list()
descendants = Queue()
descendants.pu... | true | true |
f75e96775cd11cc30ac246104267d9b082c316ab | 40,641 | py | Python | src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py | pengbeicn/turicreate | 43930dc95d1d74da21214b2ea8c717200daeaca6 | [
"BSD-3-Clause"
] | null | null | null | src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py | pengbeicn/turicreate | 43930dc95d1d74da21214b2ea8c717200daeaca6 | [
"BSD-3-Clause"
] | null | null | null | src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py | pengbeicn/turicreate | 43930dc95d1d74da21214b2ea8c717200daeaca6 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright © 2017 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
"""
Class definition and utilities for the activity classification toolkit.
"""
from... | 43.419872 | 119 | 0.599567 | from __future__ import absolute_import as _
from __future__ import print_function as _
from __future__ import division as _
import numpy as _np
import time as _time
import six as _six
from turicreate import SArray as _SArray, SFrame as _SFrame
from turicreate import aggregate as _agg
import turicreate.toolkits._inte... | true | true |
f75e96d03943d80dfc2c33ec15de4bf9add6c2ce | 1,022 | py | Python | experiments/arcbench_data_preparation/arc_model_data_preparation.py | joschout/Multi-Directional-Rule-Set-Learning | ef0620b115f4e0fd7fba3e752d238a8020c1ca6b | [
"Apache-2.0"
] | 3 | 2020-08-03T19:25:44.000Z | 2021-06-27T22:25:55.000Z | experiments/arcbench_data_preparation/arc_model_data_preparation.py | joschout/Multi-Directional-Rule-Set-Learning | ef0620b115f4e0fd7fba3e752d238a8020c1ca6b | [
"Apache-2.0"
] | null | null | null | experiments/arcbench_data_preparation/arc_model_data_preparation.py | joschout/Multi-Directional-Rule-Set-Learning | ef0620b115f4e0fd7fba3e752d238a8020c1ca6b | [
"Apache-2.0"
] | 2 | 2020-08-07T22:54:28.000Z | 2021-02-18T06:11:01.000Z | import pandas as pd
from experiments.arcbench_data_preparation.reworked_one_hot_encoding import get_original_data_fold_abs_file_name, \
TrainTestEnum
from mdrsl.data_handling.nan_data_filtering import remove_instances_with_nans_in_column
from mdrsl.data_handling.reorder_dataset_columns import reorder_columns
def... | 42.583333 | 115 | 0.807241 | import pandas as pd
from experiments.arcbench_data_preparation.reworked_one_hot_encoding import get_original_data_fold_abs_file_name, \
TrainTestEnum
from mdrsl.data_handling.nan_data_filtering import remove_instances_with_nans_in_column
from mdrsl.data_handling.reorder_dataset_columns import reorder_columns
def... | true | true |
f75e97085e5bd434674dba17e2880084e9ee71e5 | 733 | py | Python | foia_hub/settings/production.py | mikiec84/2015-foia-hub | 429c035bd6fe4bd03a5f34d8b78b63391b8df8bd | [
"CC0-1.0"
] | 33 | 2015-01-03T13:14:16.000Z | 2017-01-10T14:31:41.000Z | foia_hub/settings/production.py | mikiec84/2015-foia-hub | 429c035bd6fe4bd03a5f34d8b78b63391b8df8bd | [
"CC0-1.0"
] | 434 | 2015-01-01T18:08:27.000Z | 2017-03-22T21:46:11.000Z | foia_hub/settings/production.py | mikiec84/2015-foia-hub | 429c035bd6fe4bd03a5f34d8b78b63391b8df8bd | [
"CC0-1.0"
] | 9 | 2015-01-03T13:14:17.000Z | 2017-04-03T15:48:52.000Z | from .notdev import *
# Some possible hosts
ALLOWED_HOSTS = [
'open-foia-test.app.cloud.gov',
'open.foia.gov',
'foia-a.cf.18f.us',
'foia-b.cf.18f.us',
'openfoia-staging.cf.18f.us',
'foia.app.cloud.gov',
]
# Force an HTTPS connection.
# When testing production mode locally, this may require usi... | 22.90625 | 69 | 0.729877 | from .notdev import *
ALLOWED_HOSTS = [
'open-foia-test.app.cloud.gov',
'open.foia.gov',
'foia-a.cf.18f.us',
'foia-b.cf.18f.us',
'openfoia-staging.cf.18f.us',
'foia.app.cloud.gov',
]
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
SECURE_HSTS_SECONDS ... | true | true |
f75e998f8ddd46f5d953d549287c8a8144084691 | 2,948 | py | Python | gbpservice/nfp/orchestrator/modules/__init__.py | baodongli/group-based-policy | f3b892ecdc1051b204376e18679f73bf457ce7dc | [
"Apache-2.0"
] | null | null | null | gbpservice/nfp/orchestrator/modules/__init__.py | baodongli/group-based-policy | f3b892ecdc1051b204376e18679f73bf457ce7dc | [
"Apache-2.0"
] | null | null | null | gbpservice/nfp/orchestrator/modules/__init__.py | baodongli/group-based-policy | f3b892ecdc1051b204376e18679f73bf457ce7dc | [
"Apache-2.0"
] | null | null | null | # 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
# d... | 43.352941 | 79 | 0.670963 | from oslo_config import cfg as oslo_config
from gbpservice.nfp.common import constants as nfp_constants
from gbpservice.nfp.core import context
from gbpservice.nfp.orchestrator import context as module_context
context.NfpContext = module_context.NfpContext
openstack_opts = [
oslo_config.StrOpt('auth_host',
... | true | true |
f75e9a8e933048c2ce8df1103d89ff27b3b00f9b | 226 | py | Python | giico/quality_control_and_material_testing/doctype/tensile_yield_elongation_testing/test_tensile_yield_elongation_testing.py | thispl/giico | 14c5631639ab56a586a7962be9871d722c20e205 | [
"MIT"
] | null | null | null | giico/quality_control_and_material_testing/doctype/tensile_yield_elongation_testing/test_tensile_yield_elongation_testing.py | thispl/giico | 14c5631639ab56a586a7962be9871d722c20e205 | [
"MIT"
] | null | null | null | giico/quality_control_and_material_testing/doctype/tensile_yield_elongation_testing/test_tensile_yield_elongation_testing.py | thispl/giico | 14c5631639ab56a586a7962be9871d722c20e205 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2021, VHRS and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestTensileYieldElongationTesting(unittest.TestCase):
pass
| 20.545455 | 59 | 0.778761 | from __future__ import unicode_literals
import unittest
class TestTensileYieldElongationTesting(unittest.TestCase):
pass
| true | true |
f75e9b9f00f9f84646e14e8f9e1b2be7266630e1 | 365 | py | Python | fate/labeling/txt.py | Mattias1/fate | 10266406336bc4c683ff5b23af32ac3447f7f054 | [
"MIT"
] | null | null | null | fate/labeling/txt.py | Mattias1/fate | 10266406336bc4c683ff5b23af32ac3447f7f054 | [
"MIT"
] | null | null | null | fate/labeling/txt.py | Mattias1/fate | 10266406336bc4c683ff5b23af32ac3447f7f054 | [
"MIT"
] | null | null | null | import re
from .common import regex_labels, re_number, re_string
keywords = ['TODO']
re_keyword = re.compile(r'\b({})\b'.format('|'.join(keywords)))
def init(document):
document.OnGenerateLabeling.add(main)
def main(document):
regex_list = [(re_keyword, 'keyword'), (re_number, 'number'), (re_string, 'stri... | 22.8125 | 88 | 0.70137 | import re
from .common import regex_labels, re_number, re_string
keywords = ['TODO']
re_keyword = re.compile(r'\b({})\b'.format('|'.join(keywords)))
def init(document):
document.OnGenerateLabeling.add(main)
def main(document):
regex_list = [(re_keyword, 'keyword'), (re_number, 'number'), (re_string, 'stri... | true | true |
f75e9ba4a7c45dda40f636958b206cc08ec39729 | 1,033 | py | Python | Imperial College London - Mathematics for Machine Learning Specialization/Imperial College London - Mathematics for Machine Learning Multivariate Calculus/lagrange-multipliers.py | illumi-Zoldyck/Courses- | cc0c5c91eafcde2c945f557d54a88678add108fc | [
"Apache-2.0"
] | 622 | 2018-07-17T09:05:41.000Z | 2022-03-29T02:57:02.000Z | Imperial College London - Mathematics for Machine Learning Specialization/Imperial College London - Mathematics for Machine Learning Multivariate Calculus/lagrange-multipliers.py | magicsolmyr/Courses- | 88a8fc9c1abe22e3dd2989e6cb97a8f229a521b9 | [
"Apache-2.0"
] | 21 | 2019-11-10T02:06:09.000Z | 2022-01-22T23:54:11.000Z | Imperial College London - Mathematics for Machine Learning Specialization/Imperial College London - Mathematics for Machine Learning Multivariate Calculus/lagrange-multipliers.py | magicsolmyr/Courses- | 88a8fc9c1abe22e3dd2989e6cb97a8f229a521b9 | [
"Apache-2.0"
] | 906 | 2018-07-17T09:05:43.000Z | 2022-03-31T12:55:49.000Z | # salimt
# Import libraries
# Import libraries
import numpy as np
from scipy import optimize
# First we define the functions, YOU SHOULD IMPLEMENT THESE
def f (x, y) :
return - np.exp(x - y**2 + x*y)
def g (x, y) :
return np.cosh(y) + x - 2
def dfdx (x, y) :
return (1 + y) * f (x, y)
def dfdy ... | 21.978723 | 60 | 0.530494 | import numpy as np
from scipy import optimize
def f (x, y) :
return - np.exp(x - y**2 + x*y)
def g (x, y) :
return np.cosh(y) + x - 2
def dfdx (x, y) :
return (1 + y) * f (x, y)
def dfdy (x, y) :
return (- 2*y + x) * f (x, y)
def dgdx (x, y) :
return 1
def dgdy (x, y) :
return np.si... | true | true |
f75e9d316d61969db65c89100e4060d6c9f55dc1 | 8,093 | py | Python | tests/unit/test_utils.py | apifytech/apify-client-python | ebefbae724fcb11621ce666a3229206fe03ab486 | [
"Apache-2.0"
] | 5 | 2021-09-20T08:07:21.000Z | 2022-02-23T13:15:05.000Z | tests/unit/test_utils.py | apifytech/apify-client-python | ebefbae724fcb11621ce666a3229206fe03ab486 | [
"Apache-2.0"
] | 33 | 2020-11-08T23:24:08.000Z | 2021-09-20T08:42:44.000Z | tests/unit/test_utils.py | apify/apify-client-python | ebefbae724fcb11621ce666a3229206fe03ab486 | [
"Apache-2.0"
] | null | null | null | import io
import time
import unittest
from datetime import datetime, timezone
from enum import Enum
from typing import Any, Callable
from apify_client._utils import (
_encode_webhook_list_to_base64,
_is_content_type_json,
_is_content_type_text,
_is_content_type_xml,
_is_file_or_bytes,
_maybe_ex... | 44.224044 | 366 | 0.6602 | import io
import time
import unittest
from datetime import datetime, timezone
from enum import Enum
from typing import Any, Callable
from apify_client._utils import (
_encode_webhook_list_to_base64,
_is_content_type_json,
_is_content_type_text,
_is_content_type_xml,
_is_file_or_bytes,
_maybe_ex... | true | true |
f75e9d9e5e6169334b512a07db12fa97a0871bb9 | 4,286 | py | Python | src/UniFam.py | jcrosskey/unifam | 7ff125f6bb0b5093a60ffda779847ef537c02790 | [
"MIT"
] | null | null | null | src/UniFam.py | jcrosskey/unifam | 7ff125f6bb0b5093a60ffda779847ef537c02790 | [
"MIT"
] | null | null | null | src/UniFam.py | jcrosskey/unifam | 7ff125f6bb0b5093a60ffda779847ef537c02790 | [
"MIT"
] | null | null | null | '''
UniFam.py
pipeline
Created by JJ Chai on 02/24/2014
Last modified Mon Apr 20 16:58:56 EDT 2015
Copyright (c) 2014 JJ Chai (ORNL). All rights reserved.
'''
# Import Python modules
import configparser
import argparse
import sys
from datetime import datetime
# Import local modules
import UniFam_lib # in this direc... | 40.433962 | 138 | 0.603126 | import configparser
import argparse
import sys
from datetime import datetime
import UniFam_lib import UniFam_lib_batch
version_str = "1.1.0"
parser = argparse.ArgumentParser(description="Annotation of contigs/proteins using UniFam",
prog = 'UniFam', p... | true | true |
f75e9e613da7241a73ed7745e3c65fe4c4f3522c | 2,785 | py | Python | setup.py | nicolashardy/web3.py | 26d849987756f3b0dc328fdde14ea691188729be | [
"MIT"
] | null | null | null | setup.py | nicolashardy/web3.py | 26d849987756f3b0dc328fdde14ea691188729be | [
"MIT"
] | null | null | null | setup.py | nicolashardy/web3.py | 26d849987756f3b0dc328fdde14ea691188729be | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import (
find_packages,
setup,
)
extras_require = {
'tester': [
"eth-tester[py-evm]==0.1.0-beta.32",
"py-geth>=2.0.1,<3.0.0",
],
'testrpc': ["eth-testrpc>=1.3.3,<2.0.0"],
'linter': [
"flake8==3.4.1",
"... | 27.574257 | 89 | 0.522442 | from setuptools import (
find_packages,
setup,
)
extras_require = {
'tester': [
"eth-tester[py-evm]==0.1.0-beta.32",
"py-geth>=2.0.1,<3.0.0",
],
'testrpc': ["eth-testrpc>=1.3.3,<2.0.0"],
'linter': [
"flake8==3.4.1",
"isort>=4.2.15,<5",
],
'docs': [
... | true | true |
f75e9ee1306751d16eaa036baa34d984bcc22b80 | 6,966 | py | Python | utils/rule_dir_json.py | jeffcpullen/scap-security-guide | 21bfef353218080cb335c0443d024ca3bb7c0d09 | [
"BSD-3-Clause"
] | null | null | null | utils/rule_dir_json.py | jeffcpullen/scap-security-guide | 21bfef353218080cb335c0443d024ca3bb7c0d09 | [
"BSD-3-Clause"
] | null | null | null | utils/rule_dir_json.py | jeffcpullen/scap-security-guide | 21bfef353218080cb335c0443d024ca3bb7c0d09 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import sys
from collections import defaultdict
import json
import ssg.build_yaml
import ssg.oval
import ssg.build_remediations
import ssg.products
import ssg.rules
import ssg.yaml
SSG_ROOT = os.path.abspath(os.path.join(os.path.... | 34.485149 | 140 | 0.652742 |
from __future__ import print_function
import argparse
import os
import sys
from collections import defaultdict
import json
import ssg.build_yaml
import ssg.oval
import ssg.build_remediations
import ssg.products
import ssg.rules
import ssg.yaml
SSG_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..... | true | true |
f75ea08fd0f51cb3d804df094d2290d14e1faf9e | 5,065 | py | Python | test/test_directions.py | Kikehulk/openrouteservice-py | 1d7b7e680dbed0d877cbacf7511b8233bc763deb | [
"Apache-2.0"
] | 1 | 2020-04-09T21:06:15.000Z | 2020-04-09T21:06:15.000Z | test/test_directions.py | ricardodani/openrouteservice-py | e8eb1e0ad4e13c810440c087512080b9ecf809b5 | [
"Apache-2.0"
] | null | null | null | test/test_directions.py | ricardodani/openrouteservice-py | e8eb1e0ad4e13c810440c087512080b9ecf809b5 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All rights reserved.
#
# Modifications Copyright (C) 2018 HeiGIT, University of Heidelberg.
#
#
# 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... | 35.921986 | 122 | 0.609477 |
import responses
import warnings
import test as _test
from copy import deepcopy
import openrouteservice
from test.test_helper import ENDPOINT_DICT
class DirectionsTest(_test.TestCase):
valid_query = ENDPOINT_DICT['directions']
@responses.activate
def test_directions(self):
responses.add(respo... | true | true |
f75ea1d8e1c506bec3a152946ac09293d672633a | 268 | py | Python | openapi_dto_gen/cli.py | VRohou/openapi-dto-gen | 3dead8ceca067a307a981156acef73f50bf23654 | [
"MIT"
] | null | null | null | openapi_dto_gen/cli.py | VRohou/openapi-dto-gen | 3dead8ceca067a307a981156acef73f50bf23654 | [
"MIT"
] | null | null | null | openapi_dto_gen/cli.py | VRohou/openapi-dto-gen | 3dead8ceca067a307a981156acef73f50bf23654 | [
"MIT"
] | null | null | null | import click
@click.command()
@click.argument('openapi_file', envvar='OPENAPI_FILE', type=click.File('rb'))
def main(openapi_file):
"""Simple program to generate DTO Python Classes based on OpenAPI v3 Schema"""
pass
if __name__ == "__main__":
main() | 24.363636 | 82 | 0.697761 | import click
@click.command()
@click.argument('openapi_file', envvar='OPENAPI_FILE', type=click.File('rb'))
def main(openapi_file):
pass
if __name__ == "__main__":
main() | true | true |
f75ea455294de89d3875cf4bef36bbe94d6cf0d2 | 2,536 | py | Python | graphenemodeling/experiments/photonics/optical_models.py | gholdman1/Graphene-Modeling | 61fdf5941f4c43866e846902a21e58e5e1b2a47e | [
"MIT"
] | 1 | 2020-06-16T01:35:26.000Z | 2020-06-16T01:35:26.000Z | graphenemodeling/experiments/photonics/optical_models.py | gholdman1/Graphene-Modeling | 61fdf5941f4c43866e846902a21e58e5e1b2a47e | [
"MIT"
] | null | null | null | graphenemodeling/experiments/photonics/optical_models.py | gholdman1/Graphene-Modeling | 61fdf5941f4c43866e846902a21e58e5e1b2a47e | [
"MIT"
] | 2 | 2020-03-25T19:37:09.000Z | 2020-07-24T13:23:45.000Z | import os
import numpy as np
from scipy import integrate
def LorentzTerm(w,w0,gamma,s):
'''
A single term in a Lorentz Oscillator sum.
Parameters
----------
w: array-like, frequency at which to evaluate the response (rad/s)
w0: scalar, resonance frequency (rad/s)
gamma: scalar, width of the resonance (rad... | 19.067669 | 98 | 0.657729 | import os
import numpy as np
from scipy import integrate
def LorentzTerm(w,w0,gamma,s):
res = s * w0**2 / (w0**2 - w**2 - 1j*gamma*w)
return res
def Lorentzian(omega,epsinf,modes):
LorentzSum = np.zeros_like(omega)
for i in range(np.shape(modes)[0]):
LorentzSum = LorentzSum + LorentzTerm(omega,modes[i][0],... | true | true |
f75ea4ae92e8a068b533646a52217abd32668716 | 2,410 | py | Python | flop/email_user/models.py | sbrandtb/flop | b799124c0fd712d0e25c20812ffa9ac3f2213697 | [
"MIT"
] | null | null | null | flop/email_user/models.py | sbrandtb/flop | b799124c0fd712d0e25c20812ffa9ac3f2213697 | [
"MIT"
] | null | null | null | flop/email_user/models.py | sbrandtb/flop | b799124c0fd712d0e25c20812ffa9ac3f2213697 | [
"MIT"
] | null | null | null | from django.core.mail import send_mail
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, \
BaseUserManager
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class UserManager(BaseUserManager):
def _create_user(self, ... | 33.472222 | 79 | 0.652282 | from django.core.mail import send_mail
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, \
BaseUserManager
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class UserManager(BaseUserManager):
def _create_user(self, ... | true | true |
f75ea4e6c367908bac0a57a0a6700b86ad9584c4 | 5,952 | py | Python | ForgeBlog/forgeblog/tests/functional/test_feeds.py | 99Kies/allura | 745ab3c5a9bd287b365b699bd38ef94650afc32e | [
"Apache-2.0"
] | 1 | 2021-12-09T21:52:12.000Z | 2021-12-09T21:52:12.000Z | ForgeBlog/forgeblog/tests/functional/test_feeds.py | 99Kies/allura | 745ab3c5a9bd287b365b699bd38ef94650afc32e | [
"Apache-2.0"
] | null | null | null | ForgeBlog/forgeblog/tests/functional/test_feeds.py | 99Kies/allura | 745ab3c5a9bd287b365b699bd38ef94650afc32e | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# 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,... | 39.417219 | 117 | 0.605343 |
from __future__ import unicode_literals
from __future__ import absolute_import
import datetime
from nose.tools import assert_in, assert_not_in
from ming.orm.ormsession import ThreadLocalORMSession
from tg import tmpl_context as c
from alluratest.controller import TestController
from allura import model as M
from al... | true | true |
f75ea4f8e1eefd0e57f90b9ec345101bb66a0c22 | 4,234 | py | Python | pydemic/reactions.py | uiuc-covid19-modeling/pydemic | 3c0af60c2ac7e0dbf722584f61c45f9a2f993521 | [
"MIT"
] | 6 | 2020-05-29T22:52:30.000Z | 2020-11-08T23:27:07.000Z | pydemic/reactions.py | uiuc-covid19-modeling/pydemic | 3c0af60c2ac7e0dbf722584f61c45f9a2f993521 | [
"MIT"
] | null | null | null | pydemic/reactions.py | uiuc-covid19-modeling/pydemic | 3c0af60c2ac7e0dbf722584f61c45f9a2f993521 | [
"MIT"
] | 5 | 2020-06-12T01:47:18.000Z | 2022-03-29T13:26:09.000Z | __copyright__ = """
Copyright (C) 2020 George N Wong
Copyright (C) 2020 Zachary J Weiner
"""
__license__ = """
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 withou... | 29.402778 | 81 | 0.652338 | __copyright__ = """
Copyright (C) 2020 George N Wong
Copyright (C) 2020 Zachary J Weiner
"""
__license__ = """
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 withou... | true | true |
f75ea52a41bf2873a3f1ef76227b7db18e56088e | 4,678 | py | Python | saleor/core/migrations/0001_migrate_metadata.py | siyoola/saleor | 4e52b8655a5570a8ce0a3b1484b4d8b46fbd0ad0 | [
"CC-BY-4.0"
] | 1,392 | 2021-10-06T15:54:28.000Z | 2022-03-31T20:50:55.000Z | saleor/core/migrations/0001_migrate_metadata.py | siyoola/saleor | 4e52b8655a5570a8ce0a3b1484b4d8b46fbd0ad0 | [
"CC-BY-4.0"
] | 888 | 2021-10-06T10:48:54.000Z | 2022-03-31T11:00:30.000Z | saleor/core/migrations/0001_migrate_metadata.py | siyoola/saleor | 4e52b8655a5570a8ce0a3b1484b4d8b46fbd0ad0 | [
"CC-BY-4.0"
] | 538 | 2021-10-07T16:21:27.000Z | 2022-03-31T22:58:57.000Z | # Generated by Django 2.2.9 on 2020-02-07 07:32
from django.db import migrations
def flatten_model_metadata(model_with_metadata):
updated_fields = []
public_meta = model_with_metadata.metadata
private_meta = model_with_metadata.private_metadata
if public_meta:
model_with_metadata.metadata = f... | 36.263566 | 79 | 0.74006 |
from django.db import migrations
def flatten_model_metadata(model_with_metadata):
updated_fields = []
public_meta = model_with_metadata.metadata
private_meta = model_with_metadata.private_metadata
if public_meta:
model_with_metadata.metadata = flatten_metadata(public_meta)
updated_fie... | true | true |
f75ea53a031036629f787933344d657096420480 | 696 | py | Python | language/patterns/observer.py | aliaksandr-klimovich/sandbox | adab6b18f3d78a891c38609abc71b5d7a751919c | [
"Unlicense"
] | 1 | 2020-12-25T18:21:18.000Z | 2020-12-25T18:21:18.000Z | language/patterns/observer.py | aliaksandr-klimovich/sandbox | adab6b18f3d78a891c38609abc71b5d7a751919c | [
"Unlicense"
] | 1 | 2021-02-11T15:05:59.000Z | 2021-02-11T15:05:59.000Z | language/patterns/observer.py | aliaksandr-klimovich/sandbox | adab6b18f3d78a891c38609abc71b5d7a751919c | [
"Unlicense"
] | null | null | null | # https://en.wikipedia.org/wiki/Observer_pattern
class Observable:
def __init__(self):
self.__observers = []
def register_observer(self, observer):
self.__observers.append(observer)
def notify_observers(self, *args, **kwargs):
for observer in self.__observers:
observe... | 25.777778 | 69 | 0.678161 |
class Observable:
def __init__(self):
self.__observers = []
def register_observer(self, observer):
self.__observers.append(observer)
def notify_observers(self, *args, **kwargs):
for observer in self.__observers:
observer.notify(self, *args, **kwargs)
class Observer:... | true | true |
f75ea5c1a969f7e950efb86deadd0a4e4fe1a256 | 380 | py | Python | tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0002_rename_table.py | fevral13/django-migration-linter | 6fcc7b4719ab93acf3036cb27fc185de30be0bde | [
"Apache-2.0"
] | null | null | null | tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0002_rename_table.py | fevral13/django-migration-linter | 6fcc7b4719ab93acf3036cb27fc185de30be0bde | [
"Apache-2.0"
] | 1 | 2019-04-10T10:56:13.000Z | 2019-04-10T12:15:51.000Z | tests/test_project_fixtures/test_project_rename_table/test_app/migrations/0002_rename_table.py | fevral13/django-migration-linter | 6fcc7b4719ab93acf3036cb27fc185de30be0bde | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-25 14:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('test_app', '0001_create_table'),
]
operations = [
migrations.RenameModel(
... | 19 | 48 | 0.6 | from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('test_app', '0001_create_table'),
]
operations = [
migrations.RenameModel(
old_name='A',
new_name='B',
),
]
| true | true |
f75ea6a2c8945d8d6176b7ec73497209a0b3a9e9 | 20,923 | py | Python | selfdrive/car/chrysler/values.py | niewiadomcio/openpilot | 54077b0620e51d5363374733aa0e5879f73a233d | [
"MIT"
] | 1 | 2021-06-10T18:10:36.000Z | 2021-06-10T18:10:36.000Z | selfdrive/car/chrysler/values.py | niewiadomcio/openpilot | 54077b0620e51d5363374733aa0e5879f73a233d | [
"MIT"
] | null | null | null | selfdrive/car/chrysler/values.py | niewiadomcio/openpilot | 54077b0620e51d5363374733aa0e5879f73a233d | [
"MIT"
] | null | null | null | # flake8: noqa
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
class CarControllerParams:
STEER_MAX = 261 # 262 faults
STEER_DELTA_UP = 3 # 3 is stock. 100 is fine. 200 is too much it seems
STEER_DELTA_DOWN = 3 # no faults on the way down it seems
STEER_ERROR_... | 235.089888 | 1,879 | 0.544186 |
from selfdrive.car import dbc_dict
from cereal import car
Ecu = car.CarParams.Ecu
class CarControllerParams:
STEER_MAX = 261 STEER_DELTA_UP = 3 STEER_DELTA_DOWN = 3 STEER_ERROR_MAX = 80
class CAR:
PACIFICA_2017_HYBRID = "CHRYSLER PACIFICA HYBRID 2017"
PACIFICA_2018_HYBRID = "CHRYSLER PAC... | true | true |
f75ea6c2657c2d74210fb810434190ae45f4c6fa | 26,844 | py | Python | tensorflow/python/eager/context.py | 2017qiuju/tensorflow | 41948f588ba2852ebae712358117ffa86e32a24b | [
"Apache-2.0"
] | 1 | 2018-08-28T05:35:55.000Z | 2018-08-28T05:35:55.000Z | tensorflow/python/eager/context.py | 2017qiuju/tensorflow | 41948f588ba2852ebae712358117ffa86e32a24b | [
"Apache-2.0"
] | null | null | null | tensorflow/python/eager/context.py | 2017qiuju/tensorflow | 41948f588ba2852ebae712358117ffa86e32a24b | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 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... | 33.471322 | 81 | 0.715132 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import copy
import random
import threading
from tensorflow.core.protobuf import config_pb2
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.framework... | true | true |
f75ea6c50ecd8d69ee2ab2f3f2734d5482c2e07a | 525 | py | Python | doom/api/restf/resource.py | iiCodeThings/doom | a04f239abfefc4c8b70ec7c7b00b42622ec13a86 | [
"MIT"
] | 1 | 2022-02-16T08:24:27.000Z | 2022-02-16T08:24:27.000Z | doom/api/restf/resource.py | iiCodeThings/doom | a04f239abfefc4c8b70ec7c7b00b42622ec13a86 | [
"MIT"
] | null | null | null | doom/api/restf/resource.py | iiCodeThings/doom | a04f239abfefc4c8b70ec7c7b00b42622ec13a86 | [
"MIT"
] | null | null | null | import json
from flask import make_response
from flask_restful import Resource
class ErrorCode(object):
OK = (0, "OK")
class BaseResource(ErrorCode, Resource):
def build_response(self, err_code, data=None):
params = {
'meta': {
'code': err_code[0],
'mess... | 21.875 | 61 | 0.573333 | import json
from flask import make_response
from flask_restful import Resource
class ErrorCode(object):
OK = (0, "OK")
class BaseResource(ErrorCode, Resource):
def build_response(self, err_code, data=None):
params = {
'meta': {
'code': err_code[0],
'mess... | true | true |
f75ea76b299d352ae9cd11b894d78a717a76a1ed | 1,762 | py | Python | deprecated/stitcher.py | tararouras/alphabot-ppl | 4ece4d7ced3afda506ad26276671d4d9790ac164 | [
"MIT"
] | 9 | 2019-01-16T13:48:44.000Z | 2021-05-06T14:11:23.000Z | deprecated/stitcher.py | tararouras/alphabot-ppl | 4ece4d7ced3afda506ad26276671d4d9790ac164 | [
"MIT"
] | 1 | 2019-01-16T13:49:20.000Z | 2019-01-16T13:49:20.000Z | deprecated/stitcher.py | tararouras/alphabot-ppl | 4ece4d7ced3afda506ad26276671d4d9790ac164 | [
"MIT"
] | 3 | 2019-01-30T17:23:35.000Z | 2019-07-21T12:55:00.000Z | import os
import subprocess
from AlphaBot import AlphaBot
import RPi.GPIO as GPIO
from io import BytesIO
from time import sleep
from picamera import PiCamera
from PIL import Image
from dna import *
import math
import argparse
Ab = AlphaBot()
Dna = Dna()
Ab.stop()
S1 = 27 # or 22
camera = PiCamera()
camera.resolution ... | 27.968254 | 129 | 0.671964 | import os
import subprocess
from AlphaBot import AlphaBot
import RPi.GPIO as GPIO
from io import BytesIO
from time import sleep
from picamera import PiCamera
from PIL import Image
from dna import *
import math
import argparse
Ab = AlphaBot()
Dna = Dna()
Ab.stop()
S1 = 27
camera = PiCamera()
camera.resolution = (2592,... | true | true |
f75ea7ac9c9df1eeee60c12448e3dfcb2b9077c7 | 1,060 | py | Python | configs/urls.py | Accomple/APIs | 9bda2e9d5582ff511bbe5beebcefd8dc626cbc3d | [
"MIT"
] | null | null | null | configs/urls.py | Accomple/APIs | 9bda2e9d5582ff511bbe5beebcefd8dc626cbc3d | [
"MIT"
] | null | null | null | configs/urls.py | Accomple/APIs | 9bda2e9d5582ff511bbe5beebcefd8dc626cbc3d | [
"MIT"
] | null | null | null | """configs URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 37.857143 | 77 | 0.719811 | from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('accommodations/', include('accommodations.urls')),
path('accounts/', include('accounts.urls')),
path(... | true | true |
f75ea8921a55ceb5f29771391cccdd5ed9114836 | 1,400 | py | Python | aws/test_function.py | danielBCN/faas-parallelism-benchmark | cb8f3a86e02b996f8a18c7964797a3193f86d6e1 | [
"Apache-2.0"
] | 2 | 2021-05-25T09:34:11.000Z | 2021-07-20T01:25:29.000Z | aws/test_function.py | danielBCN/faas-parallelism-benchmark | cb8f3a86e02b996f8a18c7964797a3193f86d6e1 | [
"Apache-2.0"
] | null | null | null | aws/test_function.py | danielBCN/faas-parallelism-benchmark | cb8f3a86e02b996f8a18c7964797a3193f86d6e1 | [
"Apache-2.0"
] | null | null | null | import socket
import os
import time
def do_sleep():
time.sleep(1)
def do_work():
from random import random
iterations = 5_000_000
count = 0
for _ in range(iterations):
x = random()
y = random()
if x*x + y*y <= 1.0:
count = count + 1
pi = 4.0 * count / ite... | 22.95082 | 57 | 0.610714 | import socket
import os
import time
def do_sleep():
time.sleep(1)
def do_work():
from random import random
iterations = 5_000_000
count = 0
for _ in range(iterations):
x = random()
y = random()
if x*x + y*y <= 1.0:
count = count + 1
pi = 4.0 * count / ite... | true | true |
f75ea8b329655a45cd2a4928acb1cc0e88c2d3f5 | 1,318 | py | Python | chp/babel/drug_curie.py | di2ag/bkb-pathway-provider | 42824f22868c5c5d777da3facb4209744bcc6f96 | [
"MIT"
] | null | null | null | chp/babel/drug_curie.py | di2ag/bkb-pathway-provider | 42824f22868c5c5d777da3facb4209744bcc6f96 | [
"MIT"
] | 7 | 2021-01-13T22:25:46.000Z | 2021-07-29T15:26:06.000Z | chp/babel/drug_curie.py | NCATSTranslator/chp | 00668fd3d50a48fdd75abbeacaf173a3ad41942d | [
"Apache-2.0"
] | 2 | 2021-01-14T19:06:24.000Z | 2021-01-26T15:02:12.000Z | import csv
import tqdm
import requests
import threading
import queue
##########################################################
# curie_match
# Input: drug
# Output: string chembl id or 'NOT FOUND' if not found
#--------------------------------------------------------
# Description: Drug chembl ids are returned using... | 26.897959 | 107 | 0.591806 | import csv
import tqdm
import requests
import threading
import queue
def curie_match(drug):
url = 'http://mychem.info/v1/query?q=chembl.pref_name:{}&fields=chembl.molecule_chembl_id'.format(drug)
r = requests.get(url)
r_json = r.json()
hits = r_json['hits']
if len(hits) > 0:
curie = 'ChEM... | true | true |
f75ea9da08345e34aacfd2335d489a2082c31e69 | 582,662 | py | Python | openconfig/ydk/models/openconfig/openconfig_mpls.py | Maikor/ydk-py | b86c4a7c570ae3b2c5557d098420446df5de4929 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | openconfig/ydk/models/openconfig/openconfig_mpls.py | Maikor/ydk-py | b86c4a7c570ae3b2c5557d098420446df5de4929 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | openconfig/ydk/models/openconfig/openconfig_mpls.py | Maikor/ydk-py | b86c4a7c570ae3b2c5557d098420446df5de4929 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | """ openconfig_mpls
This module provides data definitions for configuration of
Multiprotocol Label Switching (MPLS) and associated protocols for
signaling and traffic engineering.
RFC 3031\: Multiprotocol Label Switching Architecture
The MPLS / TE data model consists of several modules and
submodules as shown below... | 54.947378 | 921 | 0.445009 | from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YError, YModelError
from ydk.errors.error_handler import handle_type_error as _handle_type_error
c... | true | true |
f75ea9fdbadd3cff1240d20d3bb7c9fd2200470d | 161 | py | Python | 242. Valid Anagram.py | kyok890841/FAANG-Fighting | 53830a0b3ac122292b958deb77b581754aac213b | [
"MIT"
] | null | null | null | 242. Valid Anagram.py | kyok890841/FAANG-Fighting | 53830a0b3ac122292b958deb77b581754aac213b | [
"MIT"
] | null | null | null | 242. Valid Anagram.py | kyok890841/FAANG-Fighting | 53830a0b3ac122292b958deb77b581754aac213b | [
"MIT"
] | null | null | null | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
return True if sorted([ord(c) for c in s]) == sorted([ord(c) for c in t]) else False
| 40.25 | 93 | 0.596273 | class Solution:
def isAnagram(self, s: str, t: str) -> bool:
return True if sorted([ord(c) for c in s]) == sorted([ord(c) for c in t]) else False
| true | true |
f75eaa1f446f055fb8ae3bc9de77994e95bc55ab | 23,661 | py | Python | old/all_terms_loop_days_review.py | tabataba/spectratmo-puma | 3cd9e07df012b5a7a3f298c68f8607c225b6f6a8 | [
"CECILL-B"
] | 1 | 2020-02-12T23:05:19.000Z | 2020-02-12T23:05:19.000Z | old/all_terms_loop_days_review.py | tabataba/spectratmo-puma | 3cd9e07df012b5a7a3f298c68f8607c225b6f6a8 | [
"CECILL-B"
] | null | null | null | old/all_terms_loop_days_review.py | tabataba/spectratmo-puma | 3cd9e07df012b5a7a3f298c68f8607c225b6f6a8 | [
"CECILL-B"
] | 1 | 2020-02-12T23:05:35.000Z | 2020-02-12T23:05:35.000Z | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# to use for example with ipython -pylab
# run /home/pierre/Python/Production/Energy_budget/all_terms_loop_days_review.py
# run /scratch/augier/Python/Production/Energy_budget/all_terms_loop_days_review.py
# compute some terms of the spectral energy budget.
# The memory is... | 35.687783 | 123 | 0.579688 |
import os, sys, resource
import numpy as np
import treat_simul_shtns22 as treat_simul
from time import time
import cPickle as pickle
import matplotlib.pyplot as plt
def cumsum_inv(a):
return a[::-1].cumsum()[::-1]
SAVE = 1
season = 'summer'
name_simul = 'AFES_T639'
name_simul = 'ECMWF_T1279'
Osim = treat... | false | true |
f75eaad41e5661ab9cfaf54b50ce1adf54b71f1b | 637 | py | Python | src/ant.py | andaviaco/aco | 973b9b77810af7aab74e2da0a3285516a32da1d9 | [
"MIT"
] | null | null | null | src/ant.py | andaviaco/aco | 973b9b77810af7aab74e2da0a3285516a32da1d9 | [
"MIT"
] | null | null | null | src/ant.py | andaviaco/aco | 973b9b77810af7aab74e2da0a3285516a32da1d9 | [
"MIT"
] | null | null | null |
class Ant(object):
last_position = None
tour = []
"""docstring for Ant"""
def __init__(self, name, initial_position):
super(Ant, self).__init__()
self.name = name
self.__position = initial_position
@property
def position(self):
return self.__position
@pos... | 21.233333 | 52 | 0.607535 |
class Ant(object):
last_position = None
tour = []
def __init__(self, name, initial_position):
super(Ant, self).__init__()
self.name = name
self.__position = initial_position
@property
def position(self):
return self.__position
@position.setter
def positio... | true | true |
f75eab3177844428ce9c8de0c44453f0fbe1b5e5 | 848 | py | Python | mymoney/core/middleware.py | ychab/mymoney | 9ee665d40648fd0b95f6e90d82ccf2bfc791e8af | [
"BSD-3-Clause"
] | 67 | 2015-12-22T10:27:34.000Z | 2022-03-10T21:33:18.000Z | mymoney/core/middleware.py | clebercarmo/mymoney | 9ee665d40648fd0b95f6e90d82ccf2bfc791e8af | [
"BSD-3-Clause"
] | null | null | null | mymoney/core/middleware.py | clebercarmo/mymoney | 9ee665d40648fd0b95f6e90d82ccf2bfc791e8af | [
"BSD-3-Clause"
] | 35 | 2016-08-07T11:43:51.000Z | 2022-02-21T21:20:06.000Z | from django.conf import settings
from django.contrib.auth.views import redirect_to_login
from django.shortcuts import resolve_url
from django.urls import get_script_prefix
from django.utils.deprecation import MiddlewareMixin
class AnonymousRedirectMiddleware(MiddlewareMixin):
def process_view(self, request, view... | 33.92 | 73 | 0.6875 | from django.conf import settings
from django.contrib.auth.views import redirect_to_login
from django.shortcuts import resolve_url
from django.urls import get_script_prefix
from django.utils.deprecation import MiddlewareMixin
class AnonymousRedirectMiddleware(MiddlewareMixin):
def process_view(self, request, view... | true | true |
f75eab3ef7ef5ab2b6ebe4a8ebeb7fc7ce01007f | 1,068 | py | Python | mods/PlaceHolder.py | NotSoPrivate/NotSoBot | 75a30ead638f824035bc06d93a62ba726845ceaa | [
"MIT"
] | null | null | null | mods/PlaceHolder.py | NotSoPrivate/NotSoBot | 75a30ead638f824035bc06d93a62ba726845ceaa | [
"MIT"
] | 1 | 2021-03-31T18:14:36.000Z | 2021-03-31T18:14:36.000Z | mods/PlaceHolder.py | NotSoPrivate/NotSoBot | 75a30ead638f824035bc06d93a62ba726845ceaa | [
"MIT"
] | null | null | null | from discord.ext import commands
from mods.cog import Cog
class PlaceHolder(Cog):
@commands.group()
@commands.cooldown(2, 3, commands.BucketType.guild)
async def phone(self, ctx):
if ctx.guild and ctx.guild.get_member(336961510276595722):
return
await ctx.send("\N{WARNING SIGN} NotSoPhone is not here!\n" \... | 22.723404 | 74 | 0.695693 | from discord.ext import commands
from mods.cog import Cog
class PlaceHolder(Cog):
@commands.group()
@commands.cooldown(2, 3, commands.BucketType.guild)
async def phone(self, ctx):
if ctx.guild and ctx.guild.get_member(336961510276595722):
return
await ctx.send("\N{WARNING SIGN} NotSoPhone is not here!\n" \... | true | true |
f75eac3f4d7b5178bdee45c7d804c872b257f9de | 6,289 | py | Python | deepim/config/config.py | wangg12/mx-DeepIM | b99e33193ef5b0927d79ca1d7e7d40ca3373c98c | [
"Apache-2.0"
] | 1 | 2019-05-15T09:05:00.000Z | 2019-05-15T09:05:00.000Z | deepim/config/config.py | wangg12/mx-DeepIM | b99e33193ef5b0927d79ca1d7e7d40ca3373c98c | [
"Apache-2.0"
] | 4 | 2018-09-26T17:32:37.000Z | 2019-08-21T07:27:45.000Z | deepim/config/config.py | wangg12/mx-DeepIM | b99e33193ef5b0927d79ca1d7e7d40ca3373c98c | [
"Apache-2.0"
] | 1 | 2019-02-01T16:55:08.000Z | 2019-02-01T16:55:08.000Z | # --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by Yi Li, Gu Wang
# --------------------------------------------------------
from __future__ import print_function, division
import yaml
import numpy a... | 36.563953 | 87 | 0.611544 | from __future__ import print_function, division
import yaml
import numpy as np
from easydict import EasyDict as edict
config = edict()
config.ModelNet = False
config.modelnet_root = "./data/ModelNet/"
config.MXNET_VERSION = ""
config.output_path = ""
config.symbol = ""
config.SCALES = [(480, 640)]
config.default = ... | true | true |
f75eac45b27745fe285d543205083c4351cb7ca1 | 558 | py | Python | scripts/camera_processor.py | hackcasual/ocupus | 1b4b2b6796d6f215669e62df81601d7e8a61d550 | [
"Apache-2.0"
] | null | null | null | scripts/camera_processor.py | hackcasual/ocupus | 1b4b2b6796d6f215669e62df81601d7e8a61d550 | [
"Apache-2.0"
] | null | null | null | scripts/camera_processor.py | hackcasual/ocupus | 1b4b2b6796d6f215669e62df81601d7e8a61d550 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python2
import imp
import sys
sys.path.append("/home/odroid/ocupus/python/libs")
import time
import zmq
import json
import traceback
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect ("tcp://localhost:%s" % "5550")
try_count = 0
while try_count < 10000:
try:
imp.loa... | 18.6 | 78 | 0.654122 | import imp
import sys
sys.path.append("/home/odroid/ocupus/python/libs")
import time
import zmq
import json
import traceback
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect ("tcp://localhost:%s" % "5550")
try_count = 0
while try_count < 10000:
try:
imp.load_source('ocupus', sys.... | true | true |
f75eacb5d4268362b59bdd61ee40f35bb7ffebce | 511 | py | Python | usb2.py | johanvandegriff/midi | d9151153bce1da41d005180cfe845853fb192aeb | [
"MIT"
] | null | null | null | usb2.py | johanvandegriff/midi | d9151153bce1da41d005180cfe845853fb192aeb | [
"MIT"
] | null | null | null | usb2.py | johanvandegriff/midi | d9151153bce1da41d005180cfe845853fb192aeb | [
"MIT"
] | null | null | null | #https://stackoverflow.com/questions/51007632/how-to-monitor-usb-devices-insertion#51011386
from pyudev import Context, Monitor, MonitorObserver
import time
context = Context()
monitor = Monitor.from_netlink(context)
monitor.filter_by(subsystem='usb')
def print_device_event(device):
print('background event {0.acti... | 34.066667 | 91 | 0.794521 | from pyudev import Context, Monitor, MonitorObserver
import time
context = Context()
monitor = Monitor.from_netlink(context)
monitor.filter_by(subsystem='usb')
def print_device_event(device):
print('background event {0.action}: {0.device_path}'.format(device))
observer = MonitorObserver(monitor, callback=print_dev... | true | true |
f75eadf84fa9a407d2907a56c44d779169648826 | 1,278 | py | Python | tests/test_tensor/test_tensor.py | RichardoLuo/ColossalAI | 797a9dc5a9e801d7499b8667c3ef039a38aa15ba | [
"Apache-2.0"
] | 3 | 2022-01-20T13:43:10.000Z | 2022-02-03T08:00:24.000Z | tests/test_tensor/test_tensor.py | RichardoLuo/ColossalAI | 797a9dc5a9e801d7499b8667c3ef039a38aa15ba | [
"Apache-2.0"
] | null | null | null | tests/test_tensor/test_tensor.py | RichardoLuo/ColossalAI | 797a9dc5a9e801d7499b8667c3ef039a38aa15ba | [
"Apache-2.0"
] | 1 | 2021-12-28T09:39:06.000Z | 2021-12-28T09:39:06.000Z | import torch
from colossalai.tensor import ColoTensor
from numpy import allclose
def test_tensor_indexing():
torch_t = torch.randn(2, 3)
colo_t = ColoTensor.init_from_torch_tensor(torch_t)
assert allclose(torch_t[:, 1], colo_t[:, 1].torch_tensor())
def test_lazy_init_tensor():
lazy_t = ColoTensor(2,... | 27.782609 | 91 | 0.697966 | import torch
from colossalai.tensor import ColoTensor
from numpy import allclose
def test_tensor_indexing():
torch_t = torch.randn(2, 3)
colo_t = ColoTensor.init_from_torch_tensor(torch_t)
assert allclose(torch_t[:, 1], colo_t[:, 1].torch_tensor())
def test_lazy_init_tensor():
lazy_t = ColoTensor(2,... | true | true |
f75eaed9e4d8c83b4425edf795dda623ad92d62e | 3,198 | py | Python | _modules/jails.py | nasqueron/operations | 4b4294a12fd59027e11c1e169f15c61584e57542 | [
"BSD-2-Clause"
] | 9 | 2016-11-13T00:52:58.000Z | 2020-02-06T18:27:50.000Z | _modules/jails.py | nasqueron/operations | 4b4294a12fd59027e11c1e169f15c61584e57542 | [
"BSD-2-Clause"
] | 1 | 2020-08-05T17:32:18.000Z | 2020-08-05T17:32:18.000Z | _modules/jails.py | nasqueron/operations | 4b4294a12fd59027e11c1e169f15c61584e57542 | [
"BSD-2-Clause"
] | 1 | 2020-08-03T13:30:35.000Z | 2020-08-03T13:30:35.000Z | # -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Salt — Jails execution module
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Created: 2017-10-21
# Description: Functions related to FreeBSD jails
# License: ... | 23.007194 | 71 | 0.605378 |
import errno
def _get_all_jails():
return __pillar__.get('jails', {})
def _get_default_group():
return __grains__['id']
def list(group=None):
all_jails = _get_all_jails()
if group is None:
group = _get_default_group()
if group in all_jails:
return all_jails[group]
ret... | true | true |
f75eaf8fec2f4f236f79d367c90bc58741c3ce42 | 5,192 | py | Python | MatParser.py | DrewNow/Atom2Vec | c525552b3fe1f178bbf77064b337b9fd2f8c59a7 | [
"MIT"
] | 1 | 2022-03-28T06:58:46.000Z | 2022-03-28T06:58:46.000Z | MatParser.py | DrewNow/Atom2Vec | c525552b3fe1f178bbf77064b337b9fd2f8c59a7 | [
"MIT"
] | 1 | 2022-03-28T07:02:36.000Z | 2022-03-28T07:02:36.000Z | Atom2Vec/MatParser.py | lrcfmd/PhaseSelect | 1bdcc165f5d6c77e1e7b30c12d82e2843a159cff | [
"BSD-3-Clause"
] | 1 | 2021-03-16T10:00:37.000Z | 2021-03-16T10:00:37.000Z | import re
from periodic_table import ELEMENTS, LOW_CHARS, CAP_CHARS, lookupEle
class NoSuchElementError(Exception):
"""
if the string is not actually an element, error will be raised
"""
def __init__(self, ele_str, mat_str):
super().__init__("No element named {} ({}).".format(ele_str,... | 29.83908 | 107 | 0.546225 | import re
from periodic_table import ELEMENTS, LOW_CHARS, CAP_CHARS, lookupEle
class NoSuchElementError(Exception):
def __init__(self, ele_str, mat_str):
super().__init__("No element named {} ({}).".format(ele_str, mat_str))
class ElementNotFoundError(Exception):
def __init__(self,... | true | true |
f75eb066870e86ed7b548e090cff946eb6fbc701 | 1,425 | py | Python | tests/port_tests/ring_manager_tests/test_equals.py | synapticarbors/wagyu | b98354611dceda8888f2951e9704f843a4e88c27 | [
"MIT"
] | 1 | 2021-01-20T05:49:13.000Z | 2021-01-20T05:49:13.000Z | tests/port_tests/ring_manager_tests/test_equals.py | synapticarbors/wagyu | b98354611dceda8888f2951e9704f843a4e88c27 | [
"MIT"
] | 1 | 2020-11-20T18:21:24.000Z | 2020-11-20T18:21:37.000Z | tests/port_tests/ring_manager_tests/test_equals.py | synapticarbors/wagyu | b98354611dceda8888f2951e9704f843a4e88c27 | [
"MIT"
] | 2 | 2020-11-20T18:17:31.000Z | 2021-01-20T14:58:22.000Z | from hypothesis import given
from tests.utils import (equivalence,
implication)
from wagyu.ring_manager import RingManager
from . import strategies
@given(strategies.ring_managers)
def test_reflexivity(ring_manager: RingManager) -> None:
assert ring_manager == ring_manager
@given(strat... | 39.583333 | 78 | 0.707368 | from hypothesis import given
from tests.utils import (equivalence,
implication)
from wagyu.ring_manager import RingManager
from . import strategies
@given(strategies.ring_managers)
def test_reflexivity(ring_manager: RingManager) -> None:
assert ring_manager == ring_manager
@given(strat... | true | true |
f75eb06f27806ca128b6b0089870e5b53493276d | 1,826 | py | Python | kafka-producer/file/extractor.py | peng-data-minimization/fitness-data-pipeline | 1ff8db32553e7dbae1b1e0e42ecef78a9a24cd7e | [
"MIT"
] | 1 | 2020-07-01T14:29:30.000Z | 2020-07-01T14:29:30.000Z | kafka-producer/file/extractor.py | peng-data-minimization/fitness-data-pipeline | 1ff8db32553e7dbae1b1e0e42ecef78a9a24cd7e | [
"MIT"
] | 2 | 2020-07-08T11:29:57.000Z | 2021-01-15T02:36:11.000Z | kafka-producer/file/extractor.py | peng-data-minimization/fitness-data-pipeline | 1ff8db32553e7dbae1b1e0e42ecef78a9a24cd7e | [
"MIT"
] | null | null | null | from extractor import ActivityExtractor
from fitparse import FitFile
import uuid
import os
from utils import get_base_path
import json
class FitFileActivityExtractor(ActivityExtractor):
PROVIDER_NAME = 'fitfile'
def __init__(self, file_stream):
self.fitfile = FitFile(file_stream)
self.activit... | 38.851064 | 108 | 0.651698 | from extractor import ActivityExtractor
from fitparse import FitFile
import uuid
import os
from utils import get_base_path
import json
class FitFileActivityExtractor(ActivityExtractor):
PROVIDER_NAME = 'fitfile'
def __init__(self, file_stream):
self.fitfile = FitFile(file_stream)
self.activit... | true | true |
f75eb11ef0402d05e5a61ae825c17ccbd2cbaa9e | 4,034 | py | Python | octoprint_si7021/__init__.py | nixternal/OctoPrint-Si7021 | 8626e2f806ce7c7124c8798de612375d50070e68 | [
"Unlicense"
] | 1 | 2021-12-19T20:47:24.000Z | 2021-12-19T20:47:24.000Z | octoprint_si7021/__init__.py | nixternal/OctoPrint-Si7021 | 8626e2f806ce7c7124c8798de612375d50070e68 | [
"Unlicense"
] | null | null | null | octoprint_si7021/__init__.py | nixternal/OctoPrint-Si7021 | 8626e2f806ce7c7124c8798de612375d50070e68 | [
"Unlicense"
] | null | null | null | # coding=utf-8
from __future__ import absolute_import
from octoprint.util import RepeatedTimer
from subprocess import Popen, PIPE, STDOUT
import octoprint.plugin
import re
import sys
__author__ = "Rich JOHNSON <nixternal@gmail.com>"
__license__ = 'The Unlicense http://unlicense.org/'
__copyright__ = "Copyright (C) 20... | 30.793893 | 78 | 0.566683 |
from __future__ import absolute_import
from octoprint.util import RepeatedTimer
from subprocess import Popen, PIPE, STDOUT
import octoprint.plugin
import re
import sys
__author__ = "Rich JOHNSON <nixternal@gmail.com>"
__license__ = 'The Unlicense http://unlicense.org/'
__copyright__ = "Copyright (C) 2017-2018 Rich JO... | true | true |
f75eb1aa097e838b925e351208d142f11aa43796 | 3,328 | py | Python | src/test/primaires/salle/test_contour.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | src/test/primaires/salle/test_contour.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | src/test/primaires/salle/test_contour.py | stormi/tsunami | bdc853229834b52b2ee8ed54a3161a1a3133d926 | [
"BSD-3-Clause"
] | null | null | null | # -*-coding:Utf-8 -*
# Copyright (c) 2014 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# lis... | 27.966387 | 79 | 0.64363 |
import unittest
CONTOUR_CARRE = [
(10, 10),
(11, 10),
(12, 10),
(13, 10),
(14, 10),
(14, 11),
(14, 12),
(14, 13),
(14, 14),
(13, 14),
(12, 14),
(11, 14),
(10, 14),
(10, 13),
(10, 12),
(10, 11),
]
CONTOUR_COMPLEXE = [
(20, 20),
(21, 20),
(... | true | true |
f75eb250db1a33879bfbb66ee828f20c734af14f | 1,718 | py | Python | tests/test_parameters.py | iycheng/graphviz | d05ed193a6ef1374e5d0c356704ad38534abacc9 | [
"MIT"
] | null | null | null | tests/test_parameters.py | iycheng/graphviz | d05ed193a6ef1374e5d0c356704ad38534abacc9 | [
"MIT"
] | null | null | null | tests/test_parameters.py | iycheng/graphviz | d05ed193a6ef1374e5d0c356704ad38534abacc9 | [
"MIT"
] | null | null | null | import pytest
import graphviz
from graphviz import parameters
VERIFY_FUNCS = [parameters.verify_engine,
parameters.verify_format,
parameters.verify_renderer,
parameters.verify_formatter]
@pytest.mark.parametrize(
'cls', [graphviz.Graph, graphviz.Digraph, graphviz.... | 29.118644 | 74 | 0.699069 | import pytest
import graphviz
from graphviz import parameters
VERIFY_FUNCS = [parameters.verify_engine,
parameters.verify_format,
parameters.verify_renderer,
parameters.verify_formatter]
@pytest.mark.parametrize(
'cls', [graphviz.Graph, graphviz.Digraph, graphviz.... | true | true |
f75eb300fb926465310b984c7633515e0d3306cd | 1,584 | py | Python | plugins/module_utils/enrolled_identities.py | m-g-k/ansible-collection | 80a2a5eb550c6717f8394d627faebb9abb4c8204 | [
"Apache-2.0"
] | null | null | null | plugins/module_utils/enrolled_identities.py | m-g-k/ansible-collection | 80a2a5eb550c6717f8394d627faebb9abb4c8204 | [
"Apache-2.0"
] | null | null | null | plugins/module_utils/enrolled_identities.py | m-g-k/ansible-collection | 80a2a5eb550c6717f8394d627faebb9abb4c8204 | [
"Apache-2.0"
] | 1 | 2021-04-11T21:11:30.000Z | 2021-04-11T21:11:30.000Z | #!/usr/bin/python
#
# SPDX-License-Identifier: Apache-2.0
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import base64
class EnrolledIdentity:
def __init__(self, name, cert, private_key, ca, hsm):
self.name = name
self.cert = cert
self.private_ke... | 27.789474 | 158 | 0.580808 |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import base64
class EnrolledIdentity:
def __init__(self, name, cert, private_key, ca, hsm):
self.name = name
self.cert = cert
self.private_key = private_key
self.ca = ca
self.hsm = hsm
... | true | true |
f75eb3c25083ec2a08a61bba468de27e46cc4e99 | 9,948 | py | Python | sympy/physics/mechanics/tests/test_kane.py | eriknw/sympy | b7544e2bb74c011f6098a7e886fd77f41776c2c4 | [
"BSD-3-Clause"
] | 7 | 2015-01-14T06:55:33.000Z | 2018-08-11T14:43:52.000Z | sympy/physics/mechanics/tests/test_kane.py | pbeltran/sympy-1 | 94f92b36731c2bebe6de1037c063c2a258a8a399 | [
"BSD-3-Clause"
] | 1 | 2018-02-19T04:56:04.000Z | 2018-02-19T04:56:04.000Z | sympy/physics/mechanics/tests/test_kane.py | pbeltran/sympy-1 | 94f92b36731c2bebe6de1037c063c2a258a8a399 | [
"BSD-3-Clause"
] | 1 | 2016-04-24T14:39:22.000Z | 2016-04-24T14:39:22.000Z | from sympy import cos, expand, Matrix, sin, symbols, tan
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, KanesMethod, inertia, Particle)
def test_one_dof():
# This is for a 1 dof spring-mass-damper case.
# It is described in more deta... | 38.409266 | 81 | 0.590068 | from sympy import cos, expand, Matrix, sin, symbols, tan
from sympy.physics.mechanics import (dynamicsymbols, ReferenceFrame, Point,
RigidBody, KanesMethod, inertia, Particle)
def test_one_dof():
q, u = dynamicsymbols('q u')
qd, ud = dynamicsymbols('q u', 1)
m,... | true | true |
f75eb3fb535e50d1114398812107ab6e4600ebbe | 2,543 | py | Python | tests/conftest.py | bhaevans/centerline | 3a979015e20b302af15f43924c1c8e181d2dcbd7 | [
"MIT"
] | 125 | 2016-06-07T18:41:47.000Z | 2022-03-29T21:57:28.000Z | tests/conftest.py | bhaevans/centerline | 3a979015e20b302af15f43924c1c8e181d2dcbd7 | [
"MIT"
] | 25 | 2017-06-07T03:35:22.000Z | 2022-03-01T12:49:51.000Z | tests/conftest.py | bhaevans/centerline | 3a979015e20b302af15f43924c1c8e181d2dcbd7 | [
"MIT"
] | 28 | 2016-08-19T23:34:30.000Z | 2022-03-29T01:00:38.000Z | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import shutil
import pytest
from shapely import geometry
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
TMP_DIR = os.path.join(TESTS_DIR, "tmp")
TEST_DATA_DIR = os.path.join(TESTS_DIR, "data")
SHP_DIR = os.path.join(TEST_DATA_DIR, "... | 24.931373 | 79 | 0.639402 |
from __future__ import unicode_literals
import os
import shutil
import pytest
from shapely import geometry
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
TMP_DIR = os.path.join(TESTS_DIR, "tmp")
TEST_DATA_DIR = os.path.join(TESTS_DIR, "data")
SHP_DIR = os.path.join(TEST_DATA_DIR, "shp")
GEOJSON_DIR = os.p... | true | true |
f75eb4114502640a4ba736e185a9d2cf751b50f3 | 4,172 | py | Python | src/Flask/Flask.py | pieterbork/SUPERFREQ | c5aff0a28a299e1146612f60b02d8cefd5fe74a5 | [
"MIT"
] | 3 | 2018-09-14T15:13:33.000Z | 2019-07-16T04:27:45.000Z | src/Flask/Flask.py | pieterbork/SUPERFREQ | c5aff0a28a299e1146612f60b02d8cefd5fe74a5 | [
"MIT"
] | null | null | null | src/Flask/Flask.py | pieterbork/SUPERFREQ | c5aff0a28a299e1146612f60b02d8cefd5fe74a5 | [
"MIT"
] | 2 | 2018-01-22T03:11:51.000Z | 2018-02-24T01:28:27.000Z | #!/usr/bin/env python2
#author : Jing Guo jing.guo@colorado.edu
#name : Flask.py
#purpose : The friendly GUI for novice users
#date : 2018.02.14
#version : 1.0.1
#version notes (latest): Compatible w/ python2.
from flask import Flask
from flask import render_template
from flask import url_for
from flask import requ... | 28.575342 | 145 | 0.623202 |
from flask import Flask
from flask import render_template
from flask import url_for
from flask import request
from flask import Markup
import os
import sys
import csv
import sqlite3
import traceback
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from multiprocessing import Process
app =... | true | true |
f75eb698b2b156b84e835281ee105c573d4b51ca | 2,554 | py | Python | bin/editfile.py | Cito/w4py | bba08f5974d49f5da7e88abe3eeda1037d0824a3 | [
"MIT"
] | 18 | 2016-08-01T20:15:59.000Z | 2019-12-24T16:00:03.000Z | bin/editfile.py | WebwareForPython/w4py | bba08f5974d49f5da7e88abe3eeda1037d0824a3 | [
"MIT"
] | 6 | 2016-09-13T05:48:45.000Z | 2020-01-09T18:29:12.000Z | bin/editfile.py | WebwareForPython/w4py | bba08f5974d49f5da7e88abe3eeda1037d0824a3 | [
"MIT"
] | 6 | 2016-09-16T14:32:29.000Z | 2020-01-03T18:52:16.000Z | #!/usr/bin/env python2
"""Helper script for the feature provided by the IncludeEditLink setting."""
editor = 'Vim'
editorCommands = {
'Emacs':
'gnuclient +%(line)s "%(filename)s"',
'Geany':
'geany -l %(line)s "%(filename)s"',
'Geany (Windows)':
r'start %%ProgramFiles%%\Geany\Geany... | 31.146341 | 100 | 0.602193 |
"""Helper script for the feature provided by the IncludeEditLink setting."""
editor = 'Vim'
editorCommands = {
'Emacs':
'gnuclient +%(line)s "%(filename)s"',
'Geany':
'geany -l %(line)s "%(filename)s"',
'Geany (Windows)':
r'start %%ProgramFiles%%\Geany\Geany.exe -l %(line)s "%(fil... | false | true |
f75eb6ced730af7e6279c221a5737a7665448260 | 674 | py | Python | pythonsrc/actualFindHeight.py | SethHollandsworth/cathedralProject | 24b5f79aefffe20257e18293dcef917e6eef80d2 | [
"BSD-2-Clause",
"MIT"
] | null | null | null | pythonsrc/actualFindHeight.py | SethHollandsworth/cathedralProject | 24b5f79aefffe20257e18293dcef917e6eef80d2 | [
"BSD-2-Clause",
"MIT"
] | null | null | null | pythonsrc/actualFindHeight.py | SethHollandsworth/cathedralProject | 24b5f79aefffe20257e18293dcef917e6eef80d2 | [
"BSD-2-Clause",
"MIT"
] | null | null | null | def findHeight():
# userInput = input('What file do you want to search? ')
userInput = 'v3.2.2GEOMETRYBIGGERCHOIR.GEO'
file = open(userInput,'r',encoding='cp1252')
vertices = []
for line in file:
if line[0] not in '[;CPA ' and line != '\n':
vertices += [list(map(float,line.split()))]
for point in... | 22.466667 | 58 | 0.599407 | def findHeight():
userInput = 'v3.2.2GEOMETRYBIGGERCHOIR.GEO'
file = open(userInput,'r',encoding='cp1252')
vertices = []
for line in file:
if line[0] not in '[;CPA ' and line != '\n':
vertices += [list(map(float,line.split()))]
for point in vertices:
if point[3] < 0:
point[3] *= -1
smal... | true | true |
f75eb6e7d98a36d9fb77293bfc3a54d09b90bfb4 | 2,547 | py | Python | openstack/tests/unit/identity/v3/test_user.py | gthiemonge/openstacksdk | e1c6f233eb6b07f488fe4acded72312d8d265b33 | [
"Apache-2.0"
] | null | null | null | openstack/tests/unit/identity/v3/test_user.py | gthiemonge/openstacksdk | e1c6f233eb6b07f488fe4acded72312d8d265b33 | [
"Apache-2.0"
] | null | null | null | openstack/tests/unit/identity/v3/test_user.py | gthiemonge/openstacksdk | e1c6f233eb6b07f488fe4acded72312d8d265b33 | [
"Apache-2.0"
] | 1 | 2021-03-12T14:28:28.000Z | 2021-03-12T14:28:28.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | 35.375 | 75 | 0.634472 |
from openstack.tests.unit import base
from openstack.identity.v3 import user
IDENTIFIER = 'IDENTIFIER'
EXAMPLE = {
'default_project_id': '1',
'description': '2',
'domain_id': '3',
'email': '4',
'enabled': True,
'id': IDENTIFIER,
'links': {'self': 'http://example.com/user1'},
'name': '... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.