id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
100588 | # -*- coding: utf-8 -*-
# https://www.apache.org/licenses/LICENSE-2.0.html
from copy import deepcopy
from threading import Thread
import time
import traceback
from mod_recent_stat_config_format import ConfigFormat
from mod_recent_stat_config_main import ConfigMain
from mod_recent_stat_config_wg_id import ConfigWgId
f... | StarcoderdataPython |
1641243 |
from project import *
| StarcoderdataPython |
3251166 | <gh_stars>1-10
"""
@author: jtahstu
@contact: <EMAIL>
@site: http://www.jtahstu.com
@time: 2017/12/10 00:25
"""
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import time
from pymongo import MongoClient
headers = {
'x-devtools-emulate-network-conditions-client-id': "5f2fc4da-c727-43c0-aad4-3... | StarcoderdataPython |
1739277 | #JP #Taylor #Ceasar #Dane
def log10(x):
"""
Taking a number, giving it a base and raising it to a power is log
"""
temp = x
count = 0
while temp >= 10:
temp = temp / 10
count += 1
return count
# def fib(n):
# a, b = 0,1
# wile b < n:
# print b,
# a, b = ... | StarcoderdataPython |
3282504 | """Trains U-net with architecture used in the following example.
https://github.com/zhixuhao/unet/blob/master/unet.py
For more on U-nets in general, see Ronneberger et al. (2015).
--- REFERENCES ---
<NAME>., <NAME>, and <NAME> (2015): "U-net: Convolutional networks
for biomedical image segmentation". Internatio... | StarcoderdataPython |
1601615 | from decimal import Decimal
from typing import Union, List, Optional, Sequence
from correios.models.contract import Contract
from correios.models.package import Package
from correios.models.service import Service, ExtraService, EXTRA_SERVICE_MP, EXTRA_SERVICE_AR
from correios.utils import to_decimal, to_integer
from c... | StarcoderdataPython |
3237394 | #!/usr/bin/env python
from distutils.core import setup
setup(name='notepadqq_api',
version='0.9',
description='Notepadqq API Layer for extensions',
author='<NAME>',
author_email='<EMAIL>',
url='http://notepadqq.altervista.org/',
packages=['notepadqq_api'],
download_url='https... | StarcoderdataPython |
3278099 | <filename>dbsync/server/trim.py
"""
Trim the server synchronization tables to free space.
"""
from dbsync.lang import *
from dbsync import core
from dbsync.models import Node, Version, Operation
@core.session_committing
def trim(session=None):
"""
Clears space by deleting operations and versions that are no
... | StarcoderdataPython |
1630068 | # Copyright (C) 2015 – 2021 <NAME> (4shadoww)
saveddict = None
def save_values(variables):
global saveddict
saveddict = variables
def set_values(tdict):
global saveddict
for key0 in saveddict.keys():
for key1 in tdict.keys():
if key0 == key1:
tdict[key0][0] = save... | StarcoderdataPython |
3343463 | <gh_stars>0
"""
Part 1 Sprint Challenge
There are 3 rows.
There are 2 rows with x and y >= 5.
There are 2 unique values in y
"""
import sqlite3 as sql
# Connecting to the SQLite Database and creating the Cursor
CONN = sql.connect('demo_data.sqlite3')
CURS = CONN.cursor()
# List of values to put into the table.
table_... | StarcoderdataPython |
3379524 | <reponame>lucas-bremond/cesiumpy<filename>cesiumpy/position.py
#!/usr/bin/env python
# coding: utf-8
from __future__ import annotations
from datetime import datetime
from typing import List, Optional
import traitlets
from cesiumpy.base import _CesiumEnum
import cesiumpy.entities.cartesian as cartesian
from cesiumpy... | StarcoderdataPython |
1702018 | <filename>adventure/migrations/0007_auto_20160306_0055.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-06 08:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adventure', '0006_effect_style'),
... | StarcoderdataPython |
3372746 | <filename>digsby/src/gui/browser/mac_webkit.py
'''
embedded controllable ie
'''
from __future__ import with_statement
import wx
import wx.webkit as webkit
from logging import getLogger; log = getLogger('iewindow')
from util.primitives.funcs import Delegate
class WebKitWindow(webkit.WebKitCtrl):
def __init__(sel... | StarcoderdataPython |
1747147 | '''
11 - Driving right [1]
Remember that cars dataset, containing the cars per 1000 people (cars_per_cap) and whether
people drive right (drives_right) for different countries (country)? The code that imports
this data in CSV format into Python as a DataFrame is available on the right.
In the video, you saw a step-by... | StarcoderdataPython |
3207297 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Where is my access point? Console Script.
Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://dev... | StarcoderdataPython |
4810472 | import json
import logging
import os
from pathlib import Path
from typing import Any, Dict, Union
logger = logging.getLogger(__name__)
try:
from _jsonnet import evaluate_file
except ImportError:
def evaluate_file(filename: str, **_kwargs: Any) -> str:
logger.warning("jsonnet is unavailable, treating ... | StarcoderdataPython |
3247594 | <filename>PhysicsTools/PythonAnalysis/python/LumiList.py
#!/usr/bin/env python3
from FWCore.PythonUtilities.LumiList import LumiList as ll
import warnings
warnings.warn('PhysicsTools.PythonAnalysis.LumiList is deprecated, please use FWCore.PythonUtilities.LumiList', DeprecationWarning, stacklevel=2)
class LumiList(l... | StarcoderdataPython |
21269 | # -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
import os
from io import BytesIO
from typing import List, Optional, Union
from fsspec.implementations.cached import WholeFileCacheFileSystem
from fsspec.implementations.http ... | StarcoderdataPython |
5690 | from unittest import TestCase
from datetime import date
from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date
class DetectDate(TestCase):
def test_detect_date(self):
dates_to_test = ['10-1990', '09/12/2020', 'jan 1990', 'feb 2012', '9-12-2020']
res = detect_date(dates_t... | StarcoderdataPython |
13030 | <gh_stars>0
import sys
sys.path.append('../')
import numpy as np
import tt
d = 30
n = 2 ** d
b = 1E3
h = b / (n + 1)
#x = np.arange(n)
#x = np.reshape(x, [2] * d, order = 'F')
#x = tt.tensor(x, 1e-12)
x = tt.xfun(2, d)
e = tt.ones(2, d)
x = x + e
x = x * h
sf = lambda x : np.sin(x) / x #Should be rank 2
y = tt.mul... | StarcoderdataPython |
133127 | # -*- coding: utf-8 -*-
"""
replacing new strings with old translations
"""
import polib
#old (translated) string
#new renamed string
pairs="""
An initiative by web designers to inform users about browser-updates
An initiative by websites to inform users to update their web browser
If you are on a computer that is ma... | StarcoderdataPython |
3264762 | <reponame>dali92002/DocEnTR<filename>train.py
from typing import Any
import torch
from vit_pytorch import ViT
from models.binae import BINMODEL
import torchvision.transforms as transforms
import numpy as np
import torch.optim as optim
from einops import rearrange
import loadData2 as loadData
import utils as utils
from ... | StarcoderdataPython |
3393417 | /anaconda3/lib/python3.7/random.py | StarcoderdataPython |
3304646 | <filename>binet/rbm.py
# -*- coding: utf-8 -*-
'''
Restricted Bolzmann Machine, based on sklearn
Copyright © 2013-2015 <NAME>
Licensed under GPL, version 2 or a later (see LICENSE.rst)
Note: this code is based on the BernoulliRBM from sklearn 0.15.2
© 2010 - 2014, scikit-learn developers
(BSD License, see http://scik... | StarcoderdataPython |
1783923 | <reponame>pcsubirachs/ptpybtc
from flask import Flask, Blueprint, jsonify, request, render_template, current_app
from mnemonic import Mnemonic
from flask_qrcode import QRcode
#
# User Wallet
#
#
# Place WIF as a string inside PrivateKeyTestnet() brackets
#
wallet = ''
btc_balance = ''
usd_balance = ''
address = ''
w... | StarcoderdataPython |
1693771 | # Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | StarcoderdataPython |
8778 | # -*- coding: utf-8 -*-
"""
The channel model UI module
Copyright 2017-2018, <NAME> and <NAME>
SPDX-License-Identifier: MIT
"""
# pylint: disable=import-error
import os
import xbmcgui
import xbmcplugin
import resources.lib.mvutils as mvutils
from resources.lib.channel import Channel
class ChannelUI(Channel):
... | StarcoderdataPython |
1674991 | <reponame>cdrowley/hackerrank<filename>python/Sets/no-idea.py
# https://www.hackerrank.com/challenges/no-idea/problem
_ = input()
int_list = lambda: map(int, input().split())
arr, good, bad = int_list(), set(int_list()), set(int_list())
print(sum((n in good) - (n in bad) for n in arr))
| StarcoderdataPython |
1640063 | import requests
class Http(object):
BASE_VK_API_URL = 'https://api.vk.com/method'
def __init__(self, access_token):
self._access_token = access_token
def request_method(self, url, params=None):
url = '{}/{}'.format(self.BASE_VK_API_URL, url)
parameters = {'access_token': self._ac... | StarcoderdataPython |
1680190 | # Generated by Django 3.2.6 on 2021-09-28 07:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('catalog', '0005_rename_date_of_birth_author_birth'),
]
operations = [
migrations.RenameField(
model_name='author',
old_name=... | StarcoderdataPython |
4812727 | """Top-level package for torchxs."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.0.1'
| StarcoderdataPython |
1696073 | """The ProductImage model."""
from innopoints.extensions import db
class ProductImage(db.Model):
"""Represents an ordered image for a particular variety of a product."""
__tablename__ = 'product_images'
__table_args__ = (
db.UniqueConstraint('variety_id', 'order',
name... | StarcoderdataPython |
150545 | <reponame>ENPH-2113-Silicon-Photonics/legume<gh_stars>1-10
import numpy as np
import time, sys
from itertools import zip_longest
from .slab_modes import guided_modes, rad_modes
from . import matrix_elements
from legume.backend import backend as bd
from legume.utils import get_value, ftinv, find_nearest
class GuidedM... | StarcoderdataPython |
1649404 | <reponame>saegersven/robocup
import cv2
import math
import numpy as np
def distance_weight(d: float):
return 2**(-(4.0 * d - 2.6)**2)
width = 80
height = 48
center_x = width / 2
center_y = height
m = np.empty((height, width), np.uint8)
for y in range(height):
for x in range(width):
dist = math... | StarcoderdataPython |
3316423 | import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
"""
Overrides setup "test" command, taken from here:
http://pytest.org/latest/goodpractises.html
"""
def finalize_options(self):
TestCommand.finalize_options(self)
... | StarcoderdataPython |
64379 | import os
import jwt
import time
import unittest
from django.conf import settings
from django.test import RequestFactory
from sparrow_cloud.middleware.acl_middleware import ACLMiddleware
from django.http import JsonResponse
os.environ["DJANGO_SETTINGS_MODULE"] = "tests.mock_settings"
def token():
private_key = ... | StarcoderdataPython |
3261481 | def score(word):
scrabble_scores = { 'A': 1, 'B': 3, 'C': 3, 'D': 2, 'E': 1, 'F': 4, 'G': 2, 'H': 4, 'I': 1,
'J': 8, 'K': 5, 'L': 1, 'M': 3, 'N': 1, 'O': 1, 'P': 3, 'Q': 10, 'R': 1, 'S': 1, 'T': 1, 'U': 1,
'V': 4, 'W': 4, 'X': 8, 'Y': 4, 'Z': 10 }
sum = 0
for ch in word:
ch = ch.upper... | StarcoderdataPython |
1631318 | # Generated by Django 3.0.2 on 2020-01-06 18:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0015_auto_20200106_1608'),
]
operations = [
migrations.AlterField(
model_name='spacecraft',
name='launch_veh... | StarcoderdataPython |
3225011 | <filename>tests/core/pyspec/eth2spec/test/helpers/block_processing.py
def for_ops(state, operations, fn) -> None:
for operation in operations:
fn(state, operation)
def get_process_calls(spec):
return {
# PHASE0
'process_block_header':
lambda state, block: spec.process_block... | StarcoderdataPython |
163013 | from urllib.parse import urlparse, urlunparse
class Link:
""" Dynamic link (`url` (parse/unpars)ed when set/get) """
def __init__(self, url: str, content: str = None):
self.url = url
self.content = content
@property
def url(self):
return urlunparse(
(
... | StarcoderdataPython |
1704739 | import wkskel
import os
import numpy as np
from matplotlib import pyplot as plt
import torch
from sklearn import decomposition
from genEM3.data.wkwdata import WkwData
from genEM3.data.skeleton import getAllTreeCoordinates
from genEM3.model.autoencoder2d import AE, Encoder_4_sampling_bn_1px_deep_convonly_skip, Decoder... | StarcoderdataPython |
149575 | from typing import Union, Sequence, Tuple, Callable, Dict, List
from .data.data_context import DataGetter, StaticGetter, CompositeGetter
from .input import MessageHandlerFunc, BaseInput, MessageInput
from .kbd import Keyboard, Group
from .media import Media
from .text import Multi, Format, Text
from .widget_event impo... | StarcoderdataPython |
3367994 | <gh_stars>10-100
# Copyright 2018 Regents of the University of Colorado. All Rights Reserved.
# Released under the MIT license.
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
# Verify current version before use at: https://github.com/MAVENSDC/Pytplot
import ... | StarcoderdataPython |
182498 | from pydm.widgets.qtplugin_base import qtplugin_factory
from .alarm import (TyphosAlarmCircle, TyphosAlarmEllipse, TyphosAlarmPolygon,
TyphosAlarmRectangle, TyphosAlarmTriangle)
from .display import (TyphosDeviceDisplay, TyphosDisplaySwitcher,
TyphosDisplayTitle, TyphosHelpFra... | StarcoderdataPython |
46668 | <reponame>kkcookies99/UAST
class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
l = len(nums)
if l <= 1:
return [nums]
total = 1
for i in range(2, l + 1):
total *= i
res = [[] for _ in range(total)]
div = total
for i in ra... | StarcoderdataPython |
3351712 | # Copyright 2012 The Swarming Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0 that
# can be found in the LICENSE file.
import datetime
import getpass
import hashlib
import optparse
import os
import subprocess
import sys
ROOT_DIR = os.path.dirname(os.path.absp... | StarcoderdataPython |
1742636 | <reponame>binexisHATT/Ezbuff
#!/usr/bin/env python3
from ezbuff.src.overflow import Overflow
def main():
# Instanstantiate `Overflow` object
obj = Overflow("192.168.230.10", 80, max_fuzz_bytes=2000)
# to obtain details on the object you instantiated
# print(obj)
# for more details
# print(repr(obj))
# Change... | StarcoderdataPython |
1667179 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python 3.8.8 64-bit ('cam')
# language: python
# name: python388jvsc74a57bd0acafb728b15233fa3654ff8b422... | StarcoderdataPython |
3254286 | <reponame>hjelkrem/Hybriddekning<gh_stars>0
class RasterCounter:
def __init__(self):
self.inside = 0
self.outside = 0
def hasOutsiders(self):
return self.outside > 0
def sum(self):
return self.inside + self.outside | StarcoderdataPython |
1672429 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <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:
#
# * Redistributions ... | StarcoderdataPython |
1678182 | '''
You are given an integer array nums (0-indexed). In one operation,
you can choose an element of the array and increment it by 1.
For example, if nums = [1,2,3], you can choose to increment nums[1] to make nums = [1,3,3].
Return the minimum number of operations needed to make nums strictly increasing.
An array... | StarcoderdataPython |
3105 | <filename>gui/sum_v1/views.py
import time
import os
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.views import View
from django.conf import settings
from .forms import File_uploadForm
from .models import File_upload, SummaryRes
from sim_v1.textsummary import TEXTSumm... | StarcoderdataPython |
1739040 | from sqlalchemy import desc
from . import *
def get_feed(user_id):
one_day_ago = datetime.datetime.today() - datetime.timedelta(days=1)
followers_posts_query = Post.query.\
join(
Following,
Following.follower_id == user_id and \
Post.user_id == Following.followed_id).\
filter(Post.... | StarcoderdataPython |
102600 | """module of classes holding models, pretrained or otherwise. The
SVMModel and LogisticModel classes do not admit any hyperparameter
changes, so any change requires using the basic MnistModel class.
"""
import numpy as np
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
fr... | StarcoderdataPython |
1613566 |
from aiohttp_session import setup as session_setup
from aiohttp_session.cookie_storage import EncryptedCookieStorage
async def setup(app, config):
session_setup(app, EncryptedCookieStorage(config['secret'].encode('utf-8')))
| StarcoderdataPython |
3213913 |
import pandas as pd
def colour_dtype(val):
a= 3
b= 3.0
c= 'str'
int_types = type(a)
float_types = type(b)
object_types = type(c)
if type(val) == int_types:
return 'background-color: red'
elif type(val) == float_types:
return 'background-color: green'
else:
... | StarcoderdataPython |
3372048 | <reponame>babajide07/energy-management-in-WSN<filename>src/main_ionosphere.py
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import numpy as np
import torch.utils.data as utils
impo... | StarcoderdataPython |
162991 | import json
import numpy as np
import itertools
import sys
path_name = sys.argv[1] + "/" + sys.argv[2]
pred_labels = np.load("./tmp/" + path_name + "/pred_labels_valid.npy")
num_classes = int(sys.argv[3])
num_layers = int(sys.argv[4])
total_layers = [x for x in range(num_layers)]
print("path_name: {}, num_classes: {... | StarcoderdataPython |
3373872 | import logging
import re
import torch as th
from torch import nn
from pgc_torch.conf import CONV_DIM, CONV_BACTH_NOR
from pgc_torch.errors import ConfigError, ObjectTypeError
logger = logging.getLogger('django')
def set_conv_dim():
mapping = {
1: (nn.Conv1d, nn.BatchNorm1d, nn.MaxPool1d, nn.AvgPool1d),... | StarcoderdataPython |
108743 | <reponame>jacob-litman/fittingScripts
import PolarTypeReader
import StructureXYZ
import os
import re
from os.path import join
from EspFitPolar import molec_dir_patt, check_finished_qm
from JMLUtils import eprint
def main_inner():
ptyping = PolarTypeReader.PtypeReader('polarTypes.tsv')
ref_files = []
with o... | StarcoderdataPython |
173232 | <reponame>fgerzer/l2rpn_parallel_training
import abc
import signal
from queue import Queue
import numpy as np
import pandas
from grid2op.Exceptions.Grid2OpException import Grid2OpException
from utils import StepResult, WorkerCommunication
from contextlib import contextmanager
class WorkerInterrupted(BaseException)... | StarcoderdataPython |
1637748 | <reponame>zhd785576549/py-command<gh_stars>0
from py_command.base import BaseCommand
class Command(BaseCommand):
help = "Just for test"
version = "1.0.0"
def add_arguments(self, parser):
parser.add_argument("--test", "-t", dest="test", type=str, default="Hello test", help="Test argument.")
... | StarcoderdataPython |
3326478 | <filename>interaction.py<gh_stars>0
import ray
import gym
import torch
import os
import time
import numpy as np
import numpy.random as rd
import datetime
from buffer import ReplayBuffer, ReplayBufferMP
from evaluate import RecordEpisode, RecordEvaluate, Evaluator
"""
Modify [ElegantRL](https://github.com/AI4Finance-LL... | StarcoderdataPython |
3311101 | <filename>datamessage.py<gh_stars>1-10
import json
import telegram
import sys
def notify_ending(message):
token = 'XXXX'
chat_id = 'XXXX'
bot = telegram.Bot(token=token)
bot.sendMessage(chat_id=chat_id, text=message)
f = open('data_file.json')
data = json.load(f)
length = l... | StarcoderdataPython |
1682830 | import logging
FORMAT = '%(asctime)-15s - %(name)s - %(levelname)s:%(message)s'
def setup_logger():
# todo add logging level to config file - json.
logging.basicConfig(format=FORMAT, filename='Apo.log', level=logging.INFO)
| StarcoderdataPython |
80772 | <filename>lib/ansible/modules/cloud/alicloud/ali_eip_facts.py
#!/usr/bin/python
# Copyright (c) 2017 Alibaba Group Holding Limited. <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
# This file is part of Ansible
#
# Ansible is free software: you can redist... | StarcoderdataPython |
3368293 | <reponame>AndraIonescu/aurum-datadiscovery<gh_stars>0
import numpy as np
w = None
vocab = None
ivocab = None
vector_feature_size = 0
def get_embedding_for_word(word):
if word in vocab:
return w[vocab[word], :]
else:
return None
def semantic_distance(v1, v2):
sim = np.dot(v1, v2.T)
r... | StarcoderdataPython |
184548 | def LI(): return list(map(int, input().split()))
import sys
sys.setrecursionlimit(10 ** 9)
from math import ceil
def main(*args):
A, B, C = args
if C:
if B > A:
ans = 'Aoki'
else:
ans = 'Takahashi'
else:
if A > B:
ans = 'Takahashi'
else:... | StarcoderdataPython |
3333033 | <gh_stars>0
import os
import yaml
import appdirs
import pkg_resources
def get_configpaths(filename="config.yaml"):
a = appdirs.AppDirs("bush")
for loc in (a.user_config_dir, a.site_config_dir):
yield os.path.join(loc, filename)
def get_configfile(filename="config.yaml", mode="r"):
for filepath ... | StarcoderdataPython |
1617800 | <reponame>mewjackie/iot-utilities<filename>IotCoreAppDeployment/Python/Resources/x86/ptvsd/__main__.py
# ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0.... | StarcoderdataPython |
1707253 | import unittest
from checkov.terraform.checks.resource.gcp.GKEAliasIpEnabled import check
from checkov.common.models.enums import CheckResult
class TestGKEAliasIpEnabled(unittest.TestCase):
def test_failure(self):
resource_conf = {'name': ['google_cluster'], 'monitoring_service': ['monitoring.googleapis... | StarcoderdataPython |
3297422 | from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
DEBUG = False
ALLOWED_HOSTS = ['127.0.0.1', '172.16.17.32', 'pantext.ru', 'www.pantext.ru', 'localhost']
STATIC_DIR = os.path.join(BASE_DIR, '/static')
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
DATABASES = {
'd... | StarcoderdataPython |
3366195 | <reponame>elgalu/labml<gh_stars>100-1000
from pathlib import Path
from typing import Optional, Generator
from labml.logger import inspect
def _is_valid_path(path: Path):
if path.name.startswith('_') or path.name.startswith('.'):
return False
else:
return True
def get_runs(experiments_path: ... | StarcoderdataPython |
1772763 | from pyproj import Proj
import pandas as pd
data = pd.read_csv('parking_regulation.csv')
p = Proj(r'+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs') #Nad83 State Plane Ohio North US Feet... | StarcoderdataPython |
3391263 | CONFIG = {
"markers": [
{
'd': ['2022-04-11'],
't': 8,
'l': (0, (3, 5, 1, 5, 1, 5)),
'c': '#6a26d1',
'n': 'UCSD Students Start',
's': True
},
{
'd': ['2022-04-18'],
't': 8,
'l': (0, (3... | StarcoderdataPython |
3358882 | <filename>services/github/test/test_service.py
import unittest
import os
from datetime import datetime
from util import Singleton
from .. import GithubService, GithubRemote, GithubRealRemote
@Singleton
class GithubMockRemote(GithubRemote):
def get_notifications(self):
return [{"type": "Issue", "title": "... | StarcoderdataPython |
3299585 | <reponame>YongLiuLab/BrainRadiomicsTools
from .batch import batchCal | StarcoderdataPython |
166288 | <gh_stars>100-1000
#
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# Lead Developers: <NAME> and <NAME>
# Authors: <NAME>, <NAME>, <NAME>, <NAME>
# Research Leads: <NAME>, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | StarcoderdataPython |
1752222 | <gh_stars>0
import datetime
ahora = datatime.datatime.now()
print(ahora)
print(type(ahora))
print(ahora.strftime('%d/%m/%Y %H:%M:%S'))
| StarcoderdataPython |
184290 | import sys
import os
import numpy as np
input_file = sys.argv[1]
output_file = sys.argv[2]
def _dataset_info_standard(txt_labels):
with open(txt_labels, 'r') as f:
images_list = f.readlines()
file_names = []
labels = []
for row in images_list:
row = row.split(' ')
file_names.... | StarcoderdataPython |
3341414 | <reponame>feiLinX/SciREX
import json
import re
import click
import pandas as pd
import spacy
nlp = spacy.load('en')
def convert_to_sentences(doc_id, text, clean_type) :
json_sents = []
sent_id = 0
# Divide into sections and then paragraphs
text = [[y.strip() for y in x.strip().split('\n') if len(y.st... | StarcoderdataPython |
63226 | <gh_stars>1-10
# Copyright (C) 2017-2019 <NAME>
# SPDX-License-Identifier: Apache-2.0
import dolfin
import numpy
class FieldInspector(object):
def __init__(
self, xdmf_file_name, V, startpos=(-1e100, -1e100), endpos=(1e100, 1e100)
):
"""
This class is meant for producing visualisation... | StarcoderdataPython |
4811687 | from os import path
import pytest
import {{cookiecutter.app_name}}.{{cookiecutter.endpoint_group}}_utils as {{cookiecutter.endpoint_group}}_utils
import {{cookiecutter.app_name}}.exceptions as exceptions
import helpers
HERE = path.abspath(path.dirname(__file__))
ROOT = path.dirname(HERE)
CONFIG_FILENAME = path.join... | StarcoderdataPython |
1797887 | import requests
r = requests.post(url = "https://music-meteorologist-ds.herokuapp.com", json = {"audio_features" : {"acousticness": 0.934,"danceability": 0.186,
"energy": 0.107,
"instrumentalness": 0,
"key": 5,
"liveness": 0.297,
"loudness": -14.802,
"mode": 1,
"... | StarcoderdataPython |
86585 | <gh_stars>0
import re
DISCORD_BOT_TOKEN = re.compile(r'(?:[\w\-=]+)\.(?:[\w\-=]+)\.(?:[\w\-=]+)', re.ASCII)
def mention(user_id: int) -> re.Pattern:
return re.compile(rf'<@!?{user_id}>', re.IGNORECASE | re.ASCII) | StarcoderdataPython |
1656807 | <filename>setup.py<gh_stars>10-100
#!/usr/bin/env python3
#-*- encoding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
desc = f.read()
with open('requirements.txt') as f:
install_requirements = f.read().splitlines()
extras = {}
combined = set()
for extra in ('backtransla... | StarcoderdataPython |
135212 | # a tentative script to upload all existing drstree "versions" into CMIP sqlite database
# each variable, mip, experiment, model, ensemble combination add a new instance in "instance"
# for each instance there should be at least one version in "version" table
# for each version add at least one file in table "files"
... | StarcoderdataPython |
1789859 | <reponame>ManiacalLabs/BiblioPixelTriggers<gh_stars>0
from datetime import datetime
from . sunrise_sunset import SunriseSunset
import time
import sys
try:
from bibliopixel.remote import trigger
except ImportError:
from bibliopixel.animation.remote import trigger
VALID_OPTIONS = [
'sunrise',
'sunset',... | StarcoderdataPython |
3209123 | <filename>launcher.py<gh_stars>1-10
import argparse
from glob import glob
from itertools import chain
import logging
import math
import os
import re
import sys
from time import sleep
from prettytable import PrettyTable
import pytz
import yaml
from investing import __version__
from investing import conf, InvestingLoggin... | StarcoderdataPython |
147901 | """
pypowermate: python library for Griffin Powermate Bluetooth controllers
"""
from bluepy import btle
import struct
import threading
import time
# Hardcoding these handles probably isn't the right way to do this. Instead, we
# should discover these via UUID. However, bluepy's API isn't expressive enough
# to support... | StarcoderdataPython |
1793476 | # Klasse zur Realisierung eines Highscore-Eintrags
class HighscoreEntry:
# Konstruktor, der als Eingabewerte den Nickname und
# die erreichten Punkte erwartet
def __init__(self, nickname, points):
self.__nickname = nickname
self.__points = points
# Öffentliche Methode zur Ausgabe eines... | StarcoderdataPython |
19670 | <gh_stars>10-100
"""
test_relu.py: Test suite for the ReLU estimator class :class:ReLUEstim`
"""
from __future__ import print_function
from __future__ import division
import unittest
import numpy as np
# Add the path to the vampyre package and import it
import env
env.add_vp_path()
import vampyre as vp
def logist... | StarcoderdataPython |
47387 | import normalize_sentences
import spacy
nlp = spacy.load('de_core_news_sm')
test_sentence = 'Der schlaue Fuchs sagte "Treffen um 16:20 Uhr!" aber war schon 20 Minuten früher da. Im Jahre 1995 schuf er das Gedicht.'
def test_sent(test_sentence):
result = normalize_sentences.normalize(nlp, test_sentence)
prin... | StarcoderdataPython |
3245372 | <filename>list_drivers.py
import pyodbc
for x in pyodbc.drivers():
print(x)
| StarcoderdataPython |
1755502 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 20 17:34:43 2016
@author: tomhope
"""
from __future__ import print_function
import tensorflow as tf
from keras.datasets.mnist import load_data
element_size = 28
time_steps = 28
num_classes = 10
batch_size = 128
hidden_layer_size = 128
def main():
tf.compat.v1.dis... | StarcoderdataPython |
3210720 | #!/usr/bin/env python3
"""Train an XGBoost model for colour segmentation of images.
Segmentation of up to six colours is supported. Fewer number of colours are
possible simply by providing training data for only a subset of the colours.
"""
import argparse
import pathlib
import random
import sys
import time
import c... | StarcoderdataPython |
1798438 | <filename>benchmarks/tensorflow/mnist-slp.py
#!/usr/bin/env python3
import os
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
data_dir = os.path.join(os.getenv('HOME'), 'var/data/mnist')
mnist = input_data.read_data_sets(data_dir, one_hot=True)
def slp(imput_size, class_number):
... | StarcoderdataPython |
1703351 | <reponame>EduardoNigro/pyev3<filename>examples/tracking.py
""" tracking.py
Use the infrared sensor to track the LEGO beacon.
During the loop execution of this example, the infrared sensor tracks the
LEGO beacon as it's moved from really close to the sensor to about 50
centimeters away. Then the beacon is moved from ... | StarcoderdataPython |
1731944 | print("introduce un número del 1 al 10")
num = input()
print("¿Ese es tu número favorito?")
print("1. Si")
print("2. No")
opc = input()
opcion = opc.upper()
if opcion == "SI" or opc == 1:
print("¡Qué bien!")
else:
print("¡OH! Que pena.") | StarcoderdataPython |
3321641 | from qtpy.QtWidgets import QApplication
import pyqtgraph as pg
import numpy as np
class HoverHighlight(pg.PlotWidget):
"""
Highlights any scatter spots moused-over, giving a feel that they can be clicked on for more info
"""
def __init__(self, *args, **kwargs):
super(HoverHighlight, self).__i... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.