id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11219613 | <reponame>IINamelessII/YesOrNo
from django.db import models
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
from polls.models import Poll
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.... | StarcoderdataPython |
77051 | #!/usr/bin/env python
# coding=utf-8
import numpy as np
def information_entropy(x, p):
ret = [0] * (len(x)+1)
for i in range(len(x)):
ret[i] = -p[i] * np.log2(p[i])
result = np.sum(ret[i])
return result
| StarcoderdataPython |
5052629 | from __future__ import absolute_import, division, print_function
from libtbx.test_utils.pytest import discover
tst_list = discover()
# To write tests for xia2:
# 1. Test file should be named test_*.py
# 2. Test methods should be named test_*()
# 3. Nothing else needed. Rest happens by magic.
# To run xia2 tests:
#... | StarcoderdataPython |
6613294 | <reponame>sixP-NaraKa/pyvod-chat
"""
pyvod-chat - a simple tool to download a past Twitch.tv broadcasts (VOD) chat comments!
Available on GitHub (+ documentation): https://github.com/sixP-NaraKa/pyvod-chat
"""
import os
from collections import namedtuple
import requests
import dotenv
from .vodchat import VODChat
f... | StarcoderdataPython |
1927457 | from torch import nn
from ..functions import CameraBackProjection
import torch
class Camera_back_projection_layer(nn.Module):
def __init__(self, res=128):
super(Camera_back_projection_layer, self).__init__()
assert res == 128
self.res = 128
def forward(self, depth_t, fl=418.3, cam_dis... | StarcoderdataPython |
5050339 | <reponame>vghost2008/wml<filename>object_detection2/modeling/backbone/darknet.py
#coding=utf-8
import tensorflow as tf
from .backbone import Backbone
from .build import BACKBONE_REGISTRY
from wnets.darknets import CSPDarkNet
import collections
import wmodule
import object_detection2.od_toolkit as odt
slim = tf.contrib... | StarcoderdataPython |
1870786 | <filename>greentest/test__subprocess.py
# mostly tests from test_subprocess.py that used to have problems
import sys
import os
import errno
import greentest
import gevent
from gevent import subprocess
import time
if subprocess.mswindows:
SETBINARY = 'import msvcrt; msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)... | StarcoderdataPython |
297320 | <reponame>woakes070048/IT_Services
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Oneiric Group Pty Ltd and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
import json
class ITContract(Document):
pass
@frap... | StarcoderdataPython |
12844025 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | StarcoderdataPython |
6670346 | import numpy as np
def calculate_crop_number(image, crop_height, crop_width, oc):
'''
Calculate how many sub images a nuclei image can be cropped
Args:
image: original image
crop_height: the expected height of output sub images
crop_width: the expected width of output sub images
... | StarcoderdataPython |
192296 | <reponame>assuzzanne/my-sqreen
# -*- coding: utf-8 -*-
# Copyright (c) 2016, 2017, 2018, 2019 Sqreen. All rights reserved.
# Please refer to our terms for more information:
#
# https://www.sqreen.io/terms.html
#
""" Blank request for callbacks needing a request when no one is present
"""
from .base import BaseRequ... | StarcoderdataPython |
6546563 | <filename>python/src/scraping/get_pixiv.py
import os, time, json, sys, re, datetime
import numpy as np
import i2v
from pixivpy3 import PixivAPI, AppPixivAPI
from PIL import Image
from dateutil.relativedelta import relativedelta
illust_re = re.compile("([0-9]+[^/]+$)")
illust2vec = i2v.make_i2v_with_chainer(
"illu... | StarcoderdataPython |
11326288 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# FSRobo-R Package BSDL
# ---------
# Copyright (C) 2019 FUJISOFT. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code... | StarcoderdataPython |
69809 | np = int(input('Say a number: '))
som = 0
for i in range(1,np):
if np%i == 0:
print (i),
som += i
if som == np:
print('It is a perfect number!')
else:
print ('It is not a perfect number')
| StarcoderdataPython |
5063456 | import tkinter as tk
from tkinter import filedialog
import base64
import sys
import pyperclip
root = tk.Tk()
root.withdraw()
root.clipboard_clear()
file_path = filedialog.askopenfilename()
extension = ""
if file_path.endswith('.jpg'):
extension = "jpg"
elif file_path.endswith('.png'):
extension = "png"
else:
... | StarcoderdataPython |
9639701 | <reponame>bitshares/nbs-pricefeed
from . import FeedSource
# pylint: disable=no-member
class Manual(FeedSource):
def _fetch(self):
return self.feed
| StarcoderdataPython |
1999041 | from brownie import web3
from decimal import Decimal
from enum import Enum
from hexbytes import HexBytes
from typing import Any
class RiskParameter(Enum):
K = 0
LMBDA = 1
DELTA = 2
CAP_PAYOFF = 3
CAP_NOTIONAL = 4
CAP_LEVERAGE = 5
CIRCUIT_BREAKER_WINDOW = 6
CIRCUIT_BREAKER_MINT_TARGET =... | StarcoderdataPython |
6547389 | <reponame>akoul1/mvlearn
import pytest
from mvlearn.cluster.base_cluster import BaseCluster
def test_base_cluster():
base_cluster = BaseCluster()
base_cluster.fit(Xs=None)
base_cluster.predict(Xs=None)
base_cluster.fit_predict(Xs=None)
| StarcoderdataPython |
3462524 | from typing import List
class Solution:
def partition(self, s: str) -> List[List[str]]:
self.ans = []
ds = []
self.solve(0, s, ds)
return self.ans
def solve(self, idx, s, ds):
if idx == len(s):
self.ans.append(ds[:])
return
for i in rang... | StarcoderdataPython |
3420314 | <filename>Labs/Scheduling/Miniversion.py
import csv
import numpy as np
from cvxopt import matrix, glpk,solvers
reader = csv.reader(open("NursesPreferences.csv",'r'), delimiter = "\t")
total = []
level = []
for row in reader:
## array = []
for i in range(71):
if i == 0:
level.append(float(ro... | StarcoderdataPython |
1910306 | from typing import Tuple, TYPE_CHECKING
from sqlalchemy import delete, insert, join, select, update
from sqlalchemy.engine import RowProxy
from smorest_sfs.plugins.queries.query import SAQuery
from smorest_sfs.plugins.queries.statement import SAStatement
from tests.plugins.queries.models import Item, User
if TYPE_CH... | StarcoderdataPython |
3237590 | <filename>job_title_processing/tools/occupation_nomenclature.py
# -*- coding: utf-8 -*-
"""
Process external data on nomenclature to reuse it in the classifier.
"""
from job_title_processing.tools import load_root_path
import pandas as pd
import os
import re
def get_nomenclature(langage='FR'):
if langage=='FR':
... | StarcoderdataPython |
12841335 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017~2999 - cologler <<EMAIL>>
# ----------
#
# ----------
from abc import abstractmethod
import inspect
from .common import LifeTime, IServiceProvider, IDescriptor, ICallSiteMaker
from .param_type_resolver import ParameterTypeResolver
from .e... | StarcoderdataPython |
8057421 | # Copyright (c) 2020.
# Thingiverse plugin is released under the terms of the LGPLv3 or higher.
from unittest.mock import patch
import pytest
from surrogate import surrogate
from ....ThingiBrowser.api.JsonObject import UserData
API_CALL_TIMEOUT = 10000
class TestMyMiniFactoryApiClient:
@pytest.fixture
@su... | StarcoderdataPython |
9615116 | <reponame>MartinThoma/stellar-model<gh_stars>1-10
import unittest
from stellar_model.model.horizon.account_data import AccountData
from tests.model.horizon import load_horizon_file
class TestAccountData(unittest.TestCase):
def test_valid(self):
raw_data = load_horizon_file("account_data.json")
pa... | StarcoderdataPython |
9752041 | <gh_stars>0
def split(items_in_list, chunk_size):
"""
Partition an input list into smaller lists.
:param items_in_list: The list of items to be split.
:param chunk_size: The number of items in each returned list.
:return: List
"""
for i in range(0, len(items_in_list), chunk_size):
yi... | StarcoderdataPython |
3239045 | <gh_stars>0
# Copyright (c) 2020, <NAME>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions an... | StarcoderdataPython |
8190630 | <reponame>ready-robotics/robotiq<gh_stars>0
# Copyright 2018 by READY Robotics Corporation.
# All rights reserved. No person may copy, distribute, publicly display, create derivative works from or otherwise
# use or modify this software without first obtaining a license from the READY Robotics Corporation.
import ready... | StarcoderdataPython |
11345567 | """与url字符串相关的工具代码."""
import json
from typing import Optional, Callable
from urllib.parse import urlparse
import requests as rq
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from requests_oauthlib import OAuth1
def is_url(url: str) -> bool:
"""判断url是否是url.
Args:
url (str): 待判断的url字符串
R... | StarcoderdataPython |
6599086 | <filename>teddix-common/teddix/TeddixInventory.py
#!/usr/bin/env python
#
import os
import re
import sys
import glob
import time
import psutil
import locale
import platform
import dmidecode
import subprocess
import xml.dom.minidom as minidom
import xml.etree.ElementTree as xml
# Syslog handler
import TeddixLogger
# ... | StarcoderdataPython |
6553511 | import re
class OBJ_Loader( object ):
def parse_statement( self, statement ):
"""Processes the passed in statement.
This will call the appropriate member function
for the statement dynamically.
Member functions must be in the form:
_parse_%s( self, statement )
whe... | StarcoderdataPython |
3347770 | <gh_stars>1-10
import numpy as np
from chainer import Chain, report, links as L, functions as F, as_variable, cuda
from chainer.iterators import SerialIterator
from chainer.optimizers import Adam
from chainer.training import Trainer, StandardUpdater, extensions
from chainerltr import Ranker
from chainerltr.dataset impo... | StarcoderdataPython |
1614093 | <filename>blockchain/all_challenges/2021/realworld/rwctf3rd-Re-Montagy/deploy/ethbot/index.py<gh_stars>0
import sys
import os
from conf.base import alarmsecs, workdir
import signal
import codecs
from src.main import main
import hashlib
import random
import string
def getflag(seed, teamtoken):
token=teamtoken
r... | StarcoderdataPython |
5054711 | import logging
from django.conf import settings
logger = logging.getLogger(__name__)
DEFAULT_SETTINGS = {
"CANONICAL_HOSTNAME": "",
"INDEX_TEXT_RESOURCES": True
}
class AppSettings(object):
def __init__(self, settings_key=None, default_settings={}):
self.settings_key = settings_... | StarcoderdataPython |
1987333 | <reponame>mmatl/jointseg
"""
File for picking unique, easily-distinguishable colors.
Author: <NAME>
"""
def indexed_color(i):
"""Return a color based on an index. Identical indices will always return
the same color, and the colors should contrast cleanly.
Parameters
----------
i : int
An i... | StarcoderdataPython |
6456611 | """
Copyright 2020 <NAME> by<EMAIL>
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, softwa... | StarcoderdataPython |
5005140 | class User():
"""docstring for User"""
def __init__(self, **params):
'''Init user
Load user data and return, using id or email/password
'''
self.id = 0
self.is_authenticated = True
self.is_active = True
self.is_anonymous = False
def get_id(self):
... | StarcoderdataPython |
1889605 | <gh_stars>0
from . import device
class US8P150(device.Device):
def __init__(self, site, data):
super(US8P150, self).__init__(site, data)
self.port = {}
self.parse_stat(data['stat'])
self.parse_uplink(data.get('uplink'))
self.parse_port_table(data['port_table'])
sel... | StarcoderdataPython |
18204 | #!/usr/bin/env/python3
"""Recipe for training a wav2vec-based ctc ASR system with librispeech.
The system employs wav2vec as its encoder. Decoding is performed with
ctc greedy decoder.
To run this recipe, do the following:
> python train_with_wav2vec.py hparams/train_with_wav2vec.yaml
The neural network is trained on C... | StarcoderdataPython |
4858560 | <filename>for.py
##n=int(input("enter the number:"))
##i=1
##for i in range(1,n+1):
## if i%2==0:
## print (i)
##sum=0
##for i in range(1,101):
## if i%2==0:
## sum=sum+i
##
##print(sum)
##
##sum=0
##for i in range(1,101):
## if i%2==1:
## sum=sum+i
##print(sum)
##
##
##n=int(... | StarcoderdataPython |
3339326 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Blueprint
label_writer_450 = Blueprint(
'label_writer_450', __name__, template_folder='templates', static_folder='static'
)
from . import views
from . import zpl
| StarcoderdataPython |
9672837 | from .six import ( # noqa: #401
urlparse,
urlunparse,
Generator,
)
| StarcoderdataPython |
4902078 | """
This module implements the Qt interface and is where every other module is
put together.
Here's a flow diagram with how the API and Player initialization is done
inside this module.
+-------------------------+
| Prompt with SetupWidget |
|------------... | StarcoderdataPython |
5071492 | # -*- coding: utf-8 -*-
"""
Auto Self Report v3.1
Created on Fri Feb 26 16:34:04 2021
@author: <NAME>.
Copyright (c) 2020-2021 <NAME>.. All rights reserved.
"""
"""
3.1 更新:
支持“提前唤醒 - 准时填报”功能
"""
#**********
#使用须知
#1. 使用此脚本需先安装Chrome浏览器,然后下载"chromedriver.exe"并将其添加至系统变量中,具体方法见'https://blog.cs... | StarcoderdataPython |
5018889 | <filename>nova/api/openstack/compute/server_external_events.py
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licens... | StarcoderdataPython |
3230714 | <reponame>moibenko/enstore
#!/usr/bin/env python
###############################################################################
#
# $Id$
# Plot Small Files Aggregation Statistics
#
###############################################################################
# system imports
import pg
import os
import sys
import t... | StarcoderdataPython |
8168698 | <filename>usage3.py<gh_stars>1-10
# imports
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from polire import CustomInterpolator
import xgboost
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.neighbors import KNeighborsRegresso... | StarcoderdataPython |
3540615 | <filename>classifier.py<gh_stars>1-10
def classifier(diseases, symptoms):
if len(symptoms) == 0:
print("Empty symptoms list. Try again.")
return []
if(len(diseases) == 0):
print("No matching disease found")
return []
max_match_count = 0
min_match_count = 500
for di... | StarcoderdataPython |
4862381 | <gh_stars>0
n = int(input())
# I can go from a to every number in to[a]
to = [list() for i in range(n+1)]
distance = [0 for i in range(n+1)]
for i in range(1, n+1):
a = list(map(int, input().split()))
for j in range(1, a[0]+1):
to[i].append(a[j])
queue = list()
queue.append(1)
distance[1] = 1
short... | StarcoderdataPython |
9702401 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 11 11:32:27 2018
@author: gregz
"""
import glob
import os.path as op
import numpy as np
import sys
from astropy.io import fits
from distutils.dir_util import mkpath
from input_utils import setup_parser, set_daterange, setup_logging
from utils import biweight_location
fr... | StarcoderdataPython |
6608859 | ## Automatically adapted for numpy.oldnumeric Jul 23, 2007 by
#########################################################################
#
# Date: Dec 2004 Authors: <NAME>
#
# <EMAIL>
#
# The Scripps Research Institute (TSRI)
# Molecular Graphics Lab
# La Jolla, CA 92037, USA
#
# Copyright: <NAME>... | StarcoderdataPython |
1960017 |
from load import ROOT as R
import numpy as N
import gna.constructors as C
from gna.bundle import *
from gna.expression import NIndex
class dummyvar(TransformationBundleLegacy):
def __init__(self, *args, **kwargs):
super(dummyvar, self).__init__( *args, **kwargs )
def define_variables(self):
i... | StarcoderdataPython |
362173 | import zipfile
from tqdm import tqdm
from discopy_data.data.doc import Document
from discopy_data.data.relation import Relation
def extract_arguments(annos, text):
args = {}
for a in annos:
if a[0][0] == 'T':
args[a[0]] = {
'type': a[1].split(" ")[0],
'off... | StarcoderdataPython |
8076974 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-04-13 03:57
from __future__ import unicode_literals
from django.db import migrations
import django_countries.fields
class Migration(migrations.Migration):
dependencies = [
('case_studies', '0008_casestudy_lead_content'),
]
operations ... | StarcoderdataPython |
3279198 | from cbuild.core import logger, paths, template
from cbuild.apk import create as apk_c, sign as apk_s
import glob
import time
import pathlib
import subprocess
def genpkg(pkg, repo, arch, binpkg):
if not pkg.destdir.is_dir():
pkg.log_warn(f"cannot find pkg destdir, skipping...")
return
binpath... | StarcoderdataPython |
1743990 | '''8. Write a Python program to solve (x + y) * (x + y).
Test Data : x = 4, y = 3
Expected Output : (4 + 3) ^ 2) = 49'''
x, y = 4, 3
ans = (4+3) * (4+3)
print(f"(({x} + {y}) ^ 2) = {ans}")
| StarcoderdataPython |
1808579 | <reponame>jerryuhoo/PaddleSpeech
# Copyright (c) 2021 PaddlePaddle 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... | StarcoderdataPython |
33236 | <reponame>daaawx/bearblog<filename>blogs/migrations/0012_auto_20200601_1247.py
# Generated by Django 3.0.6 on 2020-06-01 12:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blogs', '0011_auto_20200531_0915'),
]
operations = [
migratio... | StarcoderdataPython |
6454770 | """
Unit tests for the Deis CLI auth commands.
Run these tests with "python -m unittest client.tests.test_auth"
or with "./manage.py test client.AuthTest".
"""
from __future__ import unicode_literals
from unittest import TestCase
import pexpect
from .utils import DEIS
from .utils import DEIS_SERVER
from .utils impo... | StarcoderdataPython |
6501963 | <reponame>eigenfoo/ml-adventure
# Copyright 2018 <NAME>, <NAME>, <NAME>, <NAME>
#
# 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 r... | StarcoderdataPython |
6636697 | from . import BatsException
class InputArgsException(BatsException):
pass
| StarcoderdataPython |
1667854 | #!/usr/bin/python3
# Simple MQTT publishing of Modbus TCP sources
#
# Written and (C) 2018 by <NAME> <<EMAIL>>
# Provided under the terms of the MIT license
#
# Requires:
# - pyModbusTCP - https://github.com/sourceperl/pyModbusTCP
# - Eclipse Paho for Python - http://www.eclipse.org/paho/clients/python/
# frequency b... | StarcoderdataPython |
8020344 | <filename>retro/const.py<gh_stars>0
# -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position, range-builtin-not-iterating
"""
Physical constants and constant-for-us values
"""
from __future__ import absolute_import, division, print_function
__all__ = [
'omkeys_to_sd_indices', 'get_sd_idx', 'get_string_dom... | StarcoderdataPython |
11315213 | <gh_stars>1-10
#!/usr/bin/env /Users/kcoufal/miniconda3/bin/python3.7
# -*- coding: utf8 -*-
from flask import Flask
import datetime as dt
import platform
server = Flask(__name__)
@server.route("/")
def message():
return "<html><body><h1>Hi, welcome to the website</h1></body></html>"
@server.route("/date"... | StarcoderdataPython |
1665968 | def fibonacci_generator(n):
result = []
index = 0
while index <= n:
if(index == 0 or index == 1):
result.append(index)
yield index
else:
result.append(result[index-1] + result[index-2])
yield result[index]
index = index+1
fi... | StarcoderdataPython |
3463279 | #!/usr/bin/env python3
"""
Module with function to adds two arrays element-wise
"""
def add_arrays(arr1, arr2):
"""
Function to adds two arrays element-wise
Returns the a new array with the result
"""
if len(arr1) == len(arr2):
return [arr1[i] + arr2[i] for i in range(len(arr1))]
retur... | StarcoderdataPython |
3442863 | <filename>UI/youtubePlayer.py
from PyQt5 import QtCore, QtWebEngineWidgets, QtWebChannel, QtNetwork
from Assets import firebaseConfig
HTML = '''
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<style type="text/css">
html {
height: 100%;
... | StarcoderdataPython |
3515176 | <filename>opt_example.py
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 19 20:13:29 2022
@author: mahom
"""
import torch
from load_obj import load_obj
def opt_example(model,likelihood):
#DATA = load_obj("C:/Users/mahom/Desktop/GPt24_Full__std_y_allLocations.pkl");
DATA = load_obj("C:/Users/mahom/Desktop/G... | StarcoderdataPython |
8110416 | <filename>src/uvm/reg/sequences/uvm_mem_walk_seq.py
#//
#// -------------------------------------------------------------
#// Copyright 2004-2008 Synopsys, Inc.
#// Copyright 2010 Mentor Graphics Corporation
#// Copyright 2019-2020 <NAME> (tpoikela)
#// All Rights Reserved Worldwide
#//
#// Licensed unde... | StarcoderdataPython |
6636047 | #!/usr/bin/env python
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from metrilyx.dataserver import cli
from metrilyx.dataserver.server import ServerManager
def parseCliOptions():
parser = cli.DataserverOptionParser()
parser.add_option("-l", "--log-level"... | StarcoderdataPython |
1883448 | from time import sleep
def contagem(a, b, c):
if c < 0:
c *= -1
if c == 0:
c = 1
print(f'Contagem de {a} até {b} de {c} em {c}')
if a < b:
cont = a
while cont <= b:
print(f'{cont} ', end='')
cont += c
sleep(0.3)
print('Fim')
... | StarcoderdataPython |
152666 | <filename>tests/test_pykblib_exceptions.py
from unittest import TestCase
from pykblib.exceptions import KBLibException
class KeybaseExceptionTest(TestCase):
def test_exception(self):
with self.assertRaises(KBLibException) as raised:
raise KBLibException("test message")
self.assertEqua... | StarcoderdataPython |
4975150 | # Generated by Django 2.2.13 on 2020-07-20 06:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pipeline', '0033_road'),
]
operations = [
migrations.RemoveField(
model_name='community',
... | StarcoderdataPython |
3493723 | <reponame>scarcella/torchchem<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 06:50:13 2020
@author: zqwu
"""
import torch
import torch.nn as nn
import torchchem
import numpy as np
import os
from sklearn.metrics import roc_auc_score
# Settings
tox21_path = './data/tox21/tox21... | StarcoderdataPython |
11201446 | <filename>src/tuning/custom_trial.py
import random
from typing import Dict
import numpy as np
import nni
import torch
from ..data_loader.load import DataLoader, CryptoDataset
from ..models.custom.custom import train_model
# set seed
seed = 80085
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
def p... | StarcoderdataPython |
11363637 | """
.. module: historical.common.proxy
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. author:: <NAME> <<EMAIL>>
"""
import logging
import json
import math
import os
import sys
import boto3
from retrying import retry
from raven_... | StarcoderdataPython |
4838748 | <gh_stars>1-10
"""
This module contrains all the flags for the motion representation learning repository
"""
from __future__ import division
import os
from os.path import join as pjoin
import tensorflow as tf
# Modify this function to set your home directory for this repo
def home_out(path):
return pjoin(os.envir... | StarcoderdataPython |
202892 | <reponame>fpoulain/django-tapeforms
from django import forms
from tapeforms.fieldsets import TapeformFieldset, TapeformFieldsetsMixin
from tapeforms.mixins import TapeformMixin
class LargeForm(TapeformMixin, forms.Form):
first_name = forms.CharField(label='First name')
last_name = forms.CharField(label='Last... | StarcoderdataPython |
6576281 | <filename>main.py
#opencv --> comp vision
import os
num = os.getcwd()
os.chdir(num+ "/photo")
num = os.getcwd()
list = os.listdir(num)
for i in range(len(list)):
print(list[i])
| StarcoderdataPython |
1814514 | """
@author: <NAME>
@date: 2020/02/18 (yyyy/mm/dd)
9. Program a recursive function to calculate the following sum:
S = 1 + 2 + 3 + 4 + (...) + n-1 + n.
Analyze the efficiency and complexity of the provided solution.
"""
# Testing
import unittest
from U1.src.e9 import summation
class TestSummatio... | StarcoderdataPython |
8164881 | <reponame>human-analysis/3dfacefill
# 3dmm.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import numpy as np
# __all__ = ['Encoder', 'ShapeDecoder', 'AlbedoDecoder', 'AutoEncoder']
class ConvUnit(nn.Module):
def __init__(self, in_c, out_c, n_groupf=4, kernel_size=3, stride=1, pad... | StarcoderdataPython |
1652732 | <reponame>stephenneuendorffer/hls_tuner<filename>HLS_tuner/hlstuner/search/modeltuner.py
# Tuner for Regression Models
#
# Author: <NAME> (<EMAIL>)
#######################################################################################################################
# TODO: Reimplement the ModelTuner class using an S... | StarcoderdataPython |
3536333 | """
Create a zip with all recording folders required for evaluation - instead of having to store all recordings"""
import argparse
import os
from glob import glob
from os.path import join
from shutil import copytree
import numpy as np
import pandas as pd
from PIL import Image
from config import STATIONS
from helpers ... | StarcoderdataPython |
1724339 | #!/usr/bin/python
import MySQLdb
import re
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
execfile(os.path.join(BASE_DIR, 'settings.py'))
db = MySQLdb.connect(host=SETTINGS_SQL_HOST,
user=SETTINGS_SQL_USER,
passwd=<PASSWORD>,
db=SETTINGS_... | StarcoderdataPython |
9654287 | #
# This file is part of the ErlotinibGefitinib repository
# (https://github.com/DavAug/ErlotinibGefitinib/) which is released under the
# BSD 3-clause license. See accompanying LICENSE.md for copyright notice and
# full license details.
#
import numpy as np
import plotly.colors
import plotly.graph_objects as go
def... | StarcoderdataPython |
93978 | try:
# Python 3
from http.client import HTTPResponse, IncompleteRead
except (ImportError):
# Python 2
from httplib import HTTPResponse, IncompleteRead
from ..console_write import console_write
class DebuggableHTTPResponse(HTTPResponse):
"""
A custom HTTPResponse that formats debugging info fo... | StarcoderdataPython |
6615955 | <reponame>rjmolina13/CanIJailbreak2-Website
# Minimum Version List
MinVersionMap = {
"iPhone 2G": "1.0",
"iPhone 3G": "2.0", "iPhone 3GS": "3.0",
"iPhone 4": "4.0", "iPhone 4S": "5.0",
"iPhone 5": "6.0", "iPhone 5C": "7.0", "iPhone 5S": "7.0",
"iPhone 6": "8.0", "iPhone 6 Plus": "8.0",
"iPhone 6... | StarcoderdataPython |
1907731 | import numpy as np
import random
import json
import h5py
from patch_library import PatchLibrary
from glob import glob
import matplotlib.pyplot as plt
from skimage import io, color, img_as_float
from skimage.exposure import adjust_gamma
from skimage.segmentation import mark_boundaries
from sklearn.feature_extraction.ima... | StarcoderdataPython |
1841054 | from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.arm.base_resource_check import BaseResourceCheck
# https://docs.microsoft.com/en-us/azure/templates/microsoft.keyvault/vaults/secrets
class SecretExpirationDate(BaseResourceCheck):
def __init__(self):
name = "Ensure that the... | StarcoderdataPython |
3500995 | <reponame>KhadijaMahanga/bluetail<filename>bluetail/migrations/0005_externalperson.py<gh_stars>1-10
# Generated by Django 2.2.13 on 2020-07-20 16:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bluetail', '0004_ocdsrecordjson'),
]
operations... | StarcoderdataPython |
385630 | <filename>src/skmultiflow/demos/_test_sam_knn_prequential.py
import numpy as np
from skmultiflow.classification.lazy.sam_knn import SAMKNN
from skmultiflow.data.file_stream import FileStream
from skmultiflow.evaluation.evaluate_prequential import EvaluatePrequential
from skmultiflow.core.pipeline import Pipeline
def d... | StarcoderdataPython |
9705026 | """
The contents of this file are subject to the Mozilla Public License
Version 1.1 (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.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WIT... | StarcoderdataPython |
99633 | # Desenvolva um programa que pergunte a distancia de uma viagem em Km.
#Calcule o preço da passagem, cobrando R$0,50 por Km para viagens de até 200Km e R$0,45
# para viagens mais longas.
#minha resposta
#dist = float(input('Qual a distancia da sua viagem? '))
#print('Voce está prestes a começar uma viagem de {:.1f}Km'... | StarcoderdataPython |
3300154 | <reponame>JiwanChung/tapm
from torch import nn
import torch.nn.functional as F
from exp import ex
from .temporal_corr import TemporalCorrGlobal
from .no_gt import NoGtSos
# from .ss_loss import calc_l2_loss
class AblationJointSS(TemporalCorrGlobal):
def forward(self, batch, **kwargs):
return self._forwar... | StarcoderdataPython |
5182068 | <gh_stars>1-10
"""
clic.region.metadata: Tag metadata.* regions
********************************************
Add metadata.* tags to regions.
metadata.title / metadata.author regions
----------------------------------------
If there are 2 lines at the start, with an empty line after, we treat this as a
title / author... | StarcoderdataPython |
105371 | <reponame>OnionIoT/tau-lidar-camera
## Command format
COMMAND_SIZE_TOTAL = 14 ## Cammand size total
COMMAND_SIZE_HEADER = 4 ## Cammand header size
COMMAND_SIZE_CHECKSUM = 4 ## Cammand checksum size
COMMAND_SIZE_OVE... | StarcoderdataPython |
294623 | <gh_stars>0
import logging
from captcha.fields import ReCaptchaField
from django import forms
from django.contrib.auth import get_user_model
from .models import Profile
logger = logging.getLogger(__name__)
class UserForm(forms.ModelForm):
captcha = ReCaptchaField(attrs={'_no_label': True, '_no_errors': True})... | StarcoderdataPython |
5078680 | <filename>processing/shots_Distribution_Career.py<gh_stars>10-100
import requests
import urllib
import csv
import os
import sys
from time import time
from py_data_getter import data_getter
from py_db import db
db = db('nba_shots')
def initiate():
print "-------------------------"
print "shots_Distribution_... | StarcoderdataPython |
11267233 | <reponame>rcbops/tempest-zigzag<filename>tests/test_tempest_test_list.py
from tempest_zigzag.tempest_test_list import TempestTestList
from tempest_zigzag.tempest_testcase_list import TempestTestcaseList
class TestTempestTestList(object):
def test_find_by_classname(self, file_test_list):
tl = TempestTest... | StarcoderdataPython |
6493698 | from utils.enums import ScrollEnum
from utils.context_csv import CSVCustom
from scrapper.base import BaseReviewScrapper
from logs import default_logger
class AppleReviewScrapper(BaseReviewScrapper):
RE_ASSERT_URL = '^https://apps.apple.com'
CARD_XPATH = r'/html/body/div[4]/div/main/div/div/div/section/div[2]... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.