id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1708505 | from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django.contrib.auth import get_user_model
from users.models import APKBuild
from users.forms import UserChangeForm, UserCreationForm
User = get_user_model()
@admin.register(User)
class UserAdmin(auth_admin.UserAdmin):
for... | StarcoderdataPython |
1775402 | import unittest
from django.core.urlresolvers import reverse
from django_selenium.livetestcases import SeleniumLiveTestCase
from django_selenium.testcases import SeleniumElement, NoElementException
class SimpleUnitTests(unittest.TestCase):
def test_multiple_elements(self):
test_list = ['one string', 'an... | StarcoderdataPython |
1789251 | <filename>src/error_correction/dataset_utils/filter_dpr_genre.py<gh_stars>1-10
#
# Copyright (c) 2019-2021 <NAME>.
#
# This file is part of factual error correction.
# See https://jamesthorne.co.uk for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... | StarcoderdataPython |
1719440 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | StarcoderdataPython |
1779152 | <reponame>rahamath2009/git-github.com-nishant-sethi-HackerRank
'''
Created on Jun 4, 2018
@author: nishant.sethi
'''
import collections
class Graph:
def __init__(self,gdict=None):
if gdict is None:
gdict = []
self.gdict = gdict
# Get the keys of the dictionary
de... | StarcoderdataPython |
7456 | # -*- coding: utf-8 -*-
# Code will only work with Django >= 1.5. See tests/config.py
import re
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.core import validators
from django.contrib.auth.models import BaseUserManager
from oscar.apps.customer.abstract_models impor... | StarcoderdataPython |
339 | from src.events import Event
class CellPressed(Event):
def __init__(self, position):
self.position = position
def get_position(self):
return self.position | StarcoderdataPython |
4802774 | """napari plugin for reading videos."""
__version__ = "0.2.5"
| StarcoderdataPython |
1636318 | from src.Cells.Gol_Cell import Gol_Cell
# dict in the following format:
# 'SYMBOL': CLASS_NAME
CELL_TYPES = {
'#': Gol_Cell
}
| StarcoderdataPython |
3201004 | <filename>setup.py
from setuptools import setup, find_packages
setup(
name='aide_document',
version='0.1.7',
description='Provides templating engine for use within the AguaClara AIDE.',
url='https://github.com/AguaClara/aide_document',
author='Cornell <NAME>',
author_email='<EMAIL>',
licens... | StarcoderdataPython |
3357396 | from gamemap import GameMap
import requests
class MapRenderer:
def __init__(self, gamemapper):
if not isinstance(gamemapper, GameMap):
raise Exception("Wrong type for {}, {} found instead".format(map, GameMap))
def render(self):
pass
| StarcoderdataPython |
3398722 | <reponame>realsifocopypaste333/sifo-player-binary
# Generated by Django 3.0 on 2019-12-03 12:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('music', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='al... | StarcoderdataPython |
53433 | <filename>proj/ud120-projects/choose_your_own/test.py
from sklearn.cross_validation import cross_val_score
from sklearn.datasets import load_iris
from sklearn.ensemble import AdaBoostClassifier
iris = load_iris()
clf = AdaBoostClassifier(n_estimators=100)
scores = cross_val_score(clf, iris.data, iris.target)
print scor... | StarcoderdataPython |
3377218 | <reponame>Jette16/spacy-course<filename>exercises/es/test_03_09_01.py
def test():
assert Token.has_extension(
"is_country"
), "¿Registraste la extensión en el token?"
ext = Token.get_extension("is_country")
assert ext[0] == False, "¿Añadiste correctamente el valor por defecto?"
country_value... | StarcoderdataPython |
1753579 | <reponame>ace-han/onedegree
'''
Created on Sep 6, 2015
@author: ace
'''
import argparse
import re
from django.core.management.base import BaseCommand, CommandError
from openpyxl import load_workbook
from account.models import Profile
from account.utils import format_phonenumber
from friend.models import PhoneContact... | StarcoderdataPython |
1619105 | <filename>setup.py<gh_stars>1-10
from distutils.core import setup
setup(
name='py-videotime',
version=open('videotime/__init__.py').readlines()[-1].split()[-1].strip('\''),
description='Extract time overlays in videos.',
url='https://github.com/cheind/py-videotime',
packages=['videotime', 'videoti... | StarcoderdataPython |
1787118 | <gh_stars>1000+
import copy
import logging
import os
import psutil
import time
import warnings
from operator import gt, lt
from lightgbm.callback import _format_eval_result, EarlyStopException
from autogluon.core.utils.early_stopping import SimpleES
logger = logging.getLogger(__name__)
# TODO: Add option to stop i... | StarcoderdataPython |
1672687 | <reponame>rborkow/core<gh_stars>0
"""samsungctl and samsungtvws bridge classes."""
from __future__ import annotations
from abc import ABC, abstractmethod
from asyncio.exceptions import TimeoutError as AsyncioTimeoutError
import contextlib
from typing import Any
from samsungctl import Remote
from samsungctl.exceptions... | StarcoderdataPython |
1698060 | <reponame>akashtalole/python-flask-restful-api<gh_stars>1-10
from app.models import db
from app.models.base import SoftDeletionModel
class Track(SoftDeletionModel):
"""Track model class"""
__tablename__ = 'tracks'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)... | StarcoderdataPython |
1747990 | # -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2016-2020 BigML
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | StarcoderdataPython |
3253461 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright (c) 2012 <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 of source code must retain the above copyright
# notice,... | StarcoderdataPython |
3221812 | # @Author ZhangGJ
# @Date 2020/12/30 18:05
filename = '../../resources/pi_digits.txt'
with open(filename) as file_object:
lines = file_object.readlines()
pi_string = ''
for line in lines:
pi_string += line.strip()
print(pi_string)
print(len(pi_string))
| StarcoderdataPython |
1786876 | from biobb_common.tools import test_fixtures as fx
from biobb_amber.sander.sander_mdrun import sander_mdrun
class TestSanderMDRun():
def setUp(self):
fx.test_setup(self, 'sander_mdrun')
def tearDown(self):
fx.test_teardown(self)
pass
def test_sander_mdrun(self):
sander_mdr... | StarcoderdataPython |
3295319 | # Copyright 2015 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | StarcoderdataPython |
1621421 | <reponame>canhetingsky/LeetCode
#
# @lc app=leetcode id=110 lang=python3
#
# [110] Balanced Binary Tree
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isBalanc... | StarcoderdataPython |
1786403 | import time
import numpy as np
from numpy import mean
from numpy import std
from numpy import max
from numpy import min
from numpy import empty
from numpy import cov
from numpy import argmax
from numpy import argmin
import numpy.linalg as LA
import h5py
import math
from math import sqrt
import numba
from numba import j... | StarcoderdataPython |
1600241 | class Solution:
# @param s, a string
# @param dict, a set of string
# @return a boolean
def wordBreak(self, s, dict):
"""
DP solution
"""
n = len(s)
pivot = [False]*(n+1)
pivot[n] = True
link = {i: list() for i in range(n)}
for i in range(... | StarcoderdataPython |
92682 | <filename>actions/unregister_ip.py<gh_stars>0
"""
This action is deprecated and will be removed in a future release
"""
from lib.actions import BaseAction
class UnregisterIP(BaseAction):
"""
Unregister IP/tag(s) to a firewall
"""
def run(self, ip, tag, tag_list, firewall):
if not tag and... | StarcoderdataPython |
3336549 | """
1 stone = 6.3503 kg
1 pound = 0.4540 kg
1 feet = 30.48 cm
1 inch = 2.54 cm
"""
"""
This program converts stones and pounds to kg, feet and inches to cm
and also converts cm to meters then finally returns a BMI value.
"""
# Weight stones to kg
weight_stones = float(input("Weight in stones: "))
weight_stones_kg ... | StarcoderdataPython |
49026 | # Written by <NAME> 2021-09-23
import itertools
import random
import time
import phue as hue
max_number_of_exercises = 100
enable_hue = True
hue_bridge_ip = '10.0.0.169'
hue_light_name = 'Stue ved skyvedør høyre'
def input_integer_number(message):
while True:
try:
return int(input(message))
... | StarcoderdataPython |
88134 | #!usr/bin/env python
# -*- coding: utf-8 -*-
from gi.repository import Gtk
import sqlite3 as lite
def limpiar_registros(widgets):
campoUsuario.set_text("")
campoPassword.set_text("")
campoCorreo.set_text("")
campoNombre.set_text("")
campoApellido.set_text("")
campoDireccion.set_text("")
def gu... | StarcoderdataPython |
110006 | import pandas as pd
import numpy as np
import matplotlib as plt
import openpyxl
State = ['KY', 'VA', 'OH', 'PA', 'WV']
def writeData(df, name, nan_excel):
data = df[df['State'].isin([name])]
data.to_excel(r"F:\360MoveData\Users\Dell\Desktop\2019MCM_C\2019MCM_C\data\2018_MCMProblemC_DATA\{0}.xlsx".format(name))
d... | StarcoderdataPython |
1660554 | #!/usr/bin/env python
# coding=utf-8
from socket import inet_aton, inet_ntoa
from struct import unpack, pack
from struct import *
from os import system
import socket
import struct
import ctypes
import datetime
import thread
lock_sn = thread.allocate_lock()
SN = 0
def GenerateSN():
global SN, l... | StarcoderdataPython |
4836045 | <reponame>Peshal1067/OpenClimateGIS
from django.core.management.base import BaseCommand
from climatedata.tests import import_examples
class Command(BaseCommand):
help = 'Load example NC files from disk.'
def handle(self, *args, **options):
try:
import_examples()
except:
... | StarcoderdataPython |
1641024 | import ctk
import os
import slicer
import qt
from random import random
from SlicerDevelopmentToolboxUtils.mixins import GeneralModuleMixin
from SlicerPIRADSLogic.Finding import Finding
class ProstateWidget(ctk.ctkCollapsibleButton, GeneralModuleMixin):
def __init__(self, parent=None):
ctk.ctkCollapsibleButto... | StarcoderdataPython |
121360 | <filename>login.py<gh_stars>0
# 张三修定义了一个变量
num = 1
num2 = 20
num3 = 30
# 经理定义了一个变量
args = [1,2,3,4]
num4 = (1,2,3,4)
| StarcoderdataPython |
145876 | from marquez_airflow import DAG
from airflow.operators.postgres_operator import PostgresOperator
from airflow.operators.sensors import ExternalTaskSensor
from airflow.utils.dates import days_ago
default_args = {
'owner': 'datascience',
'depends_on_past': False,
'start_date': days_ago(1),
'email_on_fail... | StarcoderdataPython |
3354366 | # 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... | StarcoderdataPython |
96375 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-02-05 20:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
replaces = [
("oauth2", "0004_application_allow_access_by_email_suffix"),
("oauth2", "0005_auto_2018020... | StarcoderdataPython |
1701882 | <reponame>kvasnevskyi/elasticmagic<gh_stars>10-100
from elasticmagic.ext.pagination import BaseSearchQueryWrapper
class AsyncSearchQueryWrapper(BaseSearchQueryWrapper):
async def _getitem_async(self, k):
self._prepare_getitem(k)
self.items = list(await self.sliced_query)
self.count = (awa... | StarcoderdataPython |
1786009 | # extract-snippets.py v1.2.0 6/24/2021
# <NAME>, Amazon Web Services
# extracts tagged regions from source files and writes them to a snippets directory.
# reads list of paths from stdin and extracts snippets from these files. Takes the
# directory to which snippets should be extracted as a command line argument. Th... | StarcoderdataPython |
1697888 | # encoding=utf-8
# gui
import os
import imp
import tkinter
import tkinter.font
import tkinter.ttk
# main class
class Gui():
def __init__(self):
self.modulePath = os.path.dirname(__file__)
self.stageText = "ئېلكاتىپ" # base
self.fontName = "UKIJ Tuz Qara"
self.font = (self.fontName... | StarcoderdataPython |
161442 | <gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Genera... | StarcoderdataPython |
83891 | import http.client
import json
import logging
import os
import ssl
import threading
import urllib.parse
from base64 import b64encode
from datetime import datetime
from http.client import HTTPConnection, HTTPResponse
from typing import Optional, Dict
from pyctuator.auth import Auth, BasicAuth
# pylint: disable=too-ma... | StarcoderdataPython |
3301268 | <filename>tests/test_sheet.py
from nose.tools import eq_
from pyexcel_io.sheet import SheetWriter
class MyWriter(SheetWriter):
def set_size(self, size):
self.native_book = size
def test_write_empty_array():
test_string = "somebook"
writer = MyWriter(test_string, "somesheet", "somename")
wri... | StarcoderdataPython |
1649385 | #!/usr/bin/python2
from __future__ import absolute_import, division, print_function
import gui_elements as gui
import thread
import wx
import evora.common.utils.fits as fits_utils
import evora.common.utils.logs as log_utils
class ScriptStatus(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(sel... | StarcoderdataPython |
181621 | <filename>src/concatenate.py
__author__ = "<NAME>"
from genomic_tools_lib import Utilities, Logging
import os
import re
import gzip
import logging
def _key(x, r, sort_groups):
k = ()
s = r.search(x)
for g in sort_groups:
k = k + ( int(s.group(g)),)
return k
def run(args):
r = re.compile(ar... | StarcoderdataPython |
59994 | # Copyright (c) 2016 <NAME> (<EMAIL>)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, di... | StarcoderdataPython |
1690151 | import numpy as np
import numpy.typing as npt
from typing import List, Tuple, Optional, Union
from .config.cfg import SweepConfig
from .run import SweepRun, RunState
from .params import HyperParameter, HyperParameterSet
from sklearn import gaussian_process as sklearn_gaussian
from scipy import stats as scipy_stats
f... | StarcoderdataPython |
1659410 | <gh_stars>1-10
###################################################
#!/usr/bin/python
# author: <NAME>
# DHCP_Min.py
# date 2 Sept 2015
# modified for RyureticLabs: 19 Dec 2016
###################################################
"""How To Run This Program """
###################################################
"""
This ... | StarcoderdataPython |
3200516 | <gh_stars>0
# Generated by Django 3.0.7 on 2020-08-24 20:30
from django.db import migrations
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('kpis', '0023_auto_20200824_1429'),
]
operations = [
migrations.AlterModelManagers(
name='uni... | StarcoderdataPython |
4816044 | #!/usr/bin/env python
import ast
import os
from setuptools import setup # type: ignore[import]
def read(*relpath, **kwargs):
with open(os.path.join(os.path.dirname(__file__), *relpath),
encoding=kwargs.get("encoding", "utf8")) as fh:
return fh.read()
# Extract __version__ from the packag... | StarcoderdataPython |
75760 | <reponame>zhuanjiao2222/MultiAi<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Trains, evaluates and saves the TensorDetect model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import sys
import scipy ... | StarcoderdataPython |
4841756 | import numpy as np
import sys
import logging
import os
import time
import json
import base64
def softmax(y, axis=-1):
"""Calculates the softmax distribution.
Parameters
----------
y : ndarray
Log-probabilities.
"""
yp = y - y.max(axis=axis, keepdims=True)
epy = np.exp(yp)
ret... | StarcoderdataPython |
61781 | import re
from collections import defaultdict
def bitand(x, y):
return x & y
def bitor(x, y):
return x | y
def lshift(x, y):
return x << y
def rshift(x, y):
return x >> y
def bitnot(x):
return x ^ 65535
BIN_OPERATORS = {"AND": bitand, "OR": bitor, "LSHIFT": lshift, "RSHIFT": rshift}
UN_O... | StarcoderdataPython |
1678805 | # Eve W-Space
# Copyright 2014 <NAME> and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | StarcoderdataPython |
3244777 | """Allow access to the models, that working with DB."""
from .board import Board
| StarcoderdataPython |
3362322 |
def gocko(meas_t=1):
dets = [pil300KW, xbpm3.sumY]
xlocs1 = [-48000,-34000,-23000,-12000, 2000, 15000, 30000, 43000]
names1 = ['BWXLE-new-water30min-CsBrsoaked-THF','BWXLE-new-water30min-CsBrsoaked-DCM','BW30-new-water30min-CsBrsoaked-THF','BW30-new-water30min-CsBrsoaked-DCM',\
'BWXLE-n... | StarcoderdataPython |
1795608 | <reponame>CodeForAfrica/politwoops-tweet-collector<filename>bin/telegraaf.py<gh_stars>10-100
#!/usr/bin/env python
# encoding: utf-8
"""
kamertweets.py
Created by <NAME> on 2010-05-31.
Copyright (c) 2010 __MyCompanyName__. All rights reserved.
"""
import sys
import os
import re
import urllib
from BeautifulSoup impor... | StarcoderdataPython |
1762675 | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='yaml-tools',
version='0.1',
description='Armory tools for yaml files',
author='<NAME>',
author_email='<EMAIL>',
packages=find_packages(),
install_requires=[
'pyyaml',
'nose',
... | StarcoderdataPython |
1774710 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import os
import sys
import json
import traceback
import six
import yaml
import requests
from scalrctl import click, defaults, settings, commands, utils
__author__ = '<NAME>, <NAME>'
def _get_spec_path(api_level, extension):
return os.path.join(defaults.CONFIG_DIRECTORY,
... | StarcoderdataPython |
4842105 | <reponame>ningwenyan/Flask_Todo_Demo<filename>app/api/v1/role.py
#!/usr/bin/env python
# coding=utf-8
from flask_restful import Resource
from flask import request, jsonify
from app.commons.sqlModel import Role
class GetAllRoles(Resource):
def get(self):
roles = Role.query.all()
real_roles = []
... | StarcoderdataPython |
1696798 | import os
import subprocess
from .logger import Logger
from .stats import Stats
from .stats_vis import StatsVis
from .misc import Misc
# from .db_caller import DB_Caller
logger = Logger()
stats = Stats()
stats_vis = StatsVis()
misc = Misc()
# db = DB_Caller()
class Utils:
"""
Various tools, including loggi... | StarcoderdataPython |
3231520 | import time
TIMEOUT = 60
# we need to have this pyln.testing.utils code duplication
# as this also needs to be run without testing libs
def wait_for(success, timeout=TIMEOUT):
start_time = time.time()
interval = 0.25
while not success() and time.time() < start_time + timeout:
time.sleep(interval)... | StarcoderdataPython |
3261953 | # -*- coding: utf-8 -*-
"""
Created on Thu May 19 15:30:35 2016
@author: rmondoncancel
"""
# imports
from simulator import simulate
# Example of inputs / uncomment that and comment CLI inputs to run the
# simulation directly
model = 'monk'
duration = 5
variation = 0.2
nbSim = 50
runStatWeights = False
plotStats = []... | StarcoderdataPython |
1763436 | <reponame>nbdy/loraspi
from loraspi.LoRaTransparent import LoRaTransparentP2P
if __name__ == '__main__':
relay = LoRaTransparentP2P()
try:
relay.start()
relay.join()
except KeyboardInterrupt:
relay.stop()
relay.join()
| StarcoderdataPython |
132280 | # -- coding: utf-8 --
"""Collection of defaults assumed by the download script.
The defaults are all the allowed values for each of the variables.
More details are available are Copernicus Climate Data Store [0].
[0] https://cds.climate.copernicus.eu/cdsapp
"""
def time():
return [
"00:00",
"01:... | StarcoderdataPython |
1750990 | <filename>Task2.py
"""
Read file into texts and calls.
It's ok if you don't understand how to read files
"""
import csv
with open('texts.csv', 'r') as f:
reader = csv.reader(f)
texts = list(reader)
with open('calls.csv', 'r') as f:
reader = csv.reader(f)
calls = list(reader)
"""
TASK 2: Which telephon... | StarcoderdataPython |
108966 | <gh_stars>1-10
# Copyright (c) 2012 by Zuse-Institute Berlin and the Technical University of Denmark.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone... | StarcoderdataPython |
3292977 | <gh_stars>1-10
"""
Visualize the field created by a pair of Helmoltz coils
"""
import numpy as np
from scipy import stats
from mayavi import mlab
# "import" our data from our previous script (the import actually runs
# the script and computes B)
from compute_field import B, X, Y, Z
#################################... | StarcoderdataPython |
1987 | <reponame>Karthik-Ragunath/DDU<filename>data/dirty_mnist.py
import torch
import numpy as np
import torch.utils.data as data
from torch.utils.data import Subset
from data.fast_mnist import create_MNIST_dataset
from data.ambiguous_mnist.ambiguous_mnist_dataset import AmbiguousMNIST
def get_train_valid_loader(root, bat... | StarcoderdataPython |
62555 | # -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline
from django.utils.html import format_html, escape, mark_safe
from mptt.admin import DraggableMPTTAdmin
from .models import Comment, RootHeader
from attachment.admin import AttachmentInline, Attac... | StarcoderdataPython |
117460 | import pytz
from bs4 import BeautifulSoup
from datetime import datetime
import requests
import os
# local import
from dotenv import load_dotenv
class NaverBlog:
def __init__(self, blogUrl):
self.url = blogUrl
self.xml = blogUrl.replace("https://", "https://rss.") + ".xml"
self.contents = ... | StarcoderdataPython |
154245 | <filename>sw/device/silicon_creator/lib/crypto/tests/rsa_3072_verify_set_testvectors.py<gh_stars>1000+
#!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import sys
import h... | StarcoderdataPython |
44866 | from dataclasses import dataclass, field
from typing import Optional
from pytest import raises
from apischema import ValidationError, deserialize
from apischema.metadata import required
@dataclass
class Foo:
bar: Optional[int] = field(default=None, metadata=required)
with raises(ValidationError) as err:
d... | StarcoderdataPython |
4841833 | <reponame>smcv/py-sdl2
from math import floor
from .compat import *
__all__ = ["Color", "is_rgb_color", "is_rgba_color", "argb_to_color", "ARGB",
"rgba_to_color", "RGBA", "string_to_color", "convert_to_color",
"COLOR"]
def _clip(val, _min, _max):
return max(min(val, _max), _min)
class Col... | StarcoderdataPython |
182873 | import numpy as np
class ClassificationMatrix:
"""Provides measures of performance for prediction against targets.
Members:
self.classSymbol:
self.classes: Unique list of objects that is found in 'targets'
and prediction'. It is lexicographically ordered
... | StarcoderdataPython |
1767043 | #!/usr/bin/env python
import argparse
import json
import requests
import time
import random
def validateTestEndpointImplementation(baseUrl):
try:
seed = random.randint(10000, 99999)
url = baseUrl + "/test?id=" + str(seed)
print "Validating WsPerfLab Implementation at URL: " + url
... | StarcoderdataPython |
34395 | <filename>idgo_admin/views/sld_preview.py
# Copyright (c) 2017-2021 Neogeo-Technologies.
# 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/l... | StarcoderdataPython |
3219904 | import ecdsa
import base64
from Crypto.Hash import keccak
import chilkat
import json
# import sawtooth_rest_api.exceptions as errors
# Unlock chilkat library
chilkat.CkGlobal().UnlockBundle("Anything for 30-day trial")
def generate_keys_pair():
"""
:return: tuple of serialized secp256k1 elliptic curve privat... | StarcoderdataPython |
1711446 |
from itertools import starmap
from data.snippets.cs.mapper import *
from tools.utils.codegen import CodeGenerator, glom_templates, return_dict, starstarmap
#================================================================================================
def _register_slot_template(slot, data):
template = REGI... | StarcoderdataPython |
184543 | <reponame>cortecs-ai/pycortecs<filename>examples/provided_date_formats.py
from pycortecs.cortecs_api import CortecsApi
from pprint import pprint
def main():
"""
The example shows all provided date formats
"""
api = CortecsApi()
btc_twitter_ymd = api.get_twitter_sentiment(since="2021-03-01",
... | StarcoderdataPython |
1746123 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | StarcoderdataPython |
1776391 | <reponame>ahammadshawki8/Data-Structures-Algorithms-in-Python-
from map_base_class import *
from random import randrange
class HashMapBase(MapBase):
"""Abstract base class for map using hash-table with mad compression."""
def __init__(self,cap=11,p=109345121):
"""Create an empty hash-table map."""
... | StarcoderdataPython |
1617429 | """
Code Kata Template
"""
import unittest
def some_function():
return
class SomeTest(unittest.TestCase):
def test_something(self):
self.assertEqual(None, some_function())
if __name__ == '__main__':
unittest.main(exit=False)
| StarcoderdataPython |
1706675 | <reponame>BlaiseMarvin/FaceRecognitionPaymentSystem
import numpy as np
import cv2
import pickle
from inference import Network
cap = cv2.VideoCapture("E:/FINAL-YEAR-PROJECT/models/trainedFacenetModels/pretrainedModel/VID_20210427_130039.mp4")
caffeModel = "C:/Users/LENOVO/Desktop/KMC Internship/releaseTheKraken... | StarcoderdataPython |
82464 | # encoding: utf-8
# module Tekla.Structures.Geometry3d calls itself Geometry3d
# from Tekla.Structures,Version=2017.0.0.0,Culture=neutral,PublicKeyToken=2f04dbe497b71114
# by generator 1.145
# no doc
# no imports
# no functions
# classes
class AABB(object):
"""
AABB()
AABB(MinPoint: Point,MaxPo... | StarcoderdataPython |
3257314 | <filename>src/get_var_flanks.py
#!/usr/bin/env python
from Bio import Entrez
import sys
import getopt
def get_var_flanking_sequences(accessions,email):
flanking_sequences = {}
Entrez.email = email
for var_id in accessions:
var_id = var_id.rstrip()
if var_id.startswith('rs'):
var... | StarcoderdataPython |
61536 | #########################################
############ Kawaii Commands ############
#########################################
import discord
import random
from config import embed_color, embed_color_attention, embed_color_error, embed_color_succes
from discord.ext import commands
from cogs.data.kawaiidata import *
cl... | StarcoderdataPython |
1629572 | <reponame>eloise-b/config
bands_ls8c = {
"red": [],
"green": [],
"blue": [],
"nir": [],
"swir_1": [],
"swir_2": [],
}
bands_sentinel = {
"B01": ["coastal_aerosol"],
"B02": ["blue"],
"B03": ["green"],
"B04": ["red"],
"B05": ["red_edge_1"],
"B06": ["red_edge_2"],
"B07"... | StarcoderdataPython |
3317994 | import os, sys, inspect
import numpy as np
from copy import deepcopy
from ..mfbase import MFDataException
def get_first_val(arr):
while isinstance(arr, list) or isinstance(arr, np.ndarray):
arr = arr[0]
return arr
class TemplateGenerator(object):
"""
Abstract base class for bui... | StarcoderdataPython |
4829451 | <gh_stars>1-10
import pyPLUTO as pp
import numpy as np
import os
t0=1000000000.0
second_to_yrs=3.17e-8
cwd=os.getcwd()
wdir=cwd+'/'
outdir=cwd[cwd.rfind('/')+1:]
print wdir,outdir
nlinf = pp.nlast_info(w_dir=wdir)
D=pp.pload(0,w_dir=wdir)
PRS=D.prs
RHO=D.rho
X=D.x1
Y=D.x2
Vx=D.vx1
Vy=D.vx2 if 'vx2' in D.vars else 0.
Bx... | StarcoderdataPython |
130975 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | StarcoderdataPython |
3326295 | <gh_stars>1-10
# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. 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/... | StarcoderdataPython |
1725330 | <reponame>johnklee/algprac
#!/usr/bin/env python
import math
import os
import random
import re
import sys
from pprint import pprint
magic_squares = [[[2, 7, 6], [9, 5, 1], [4, 3, 8]],
[[2, 9, 4], [7, 5, 3], [6, 1, 8]],
[[4, 3, 8], [9, 5, 1], [2, 7, 6]],
[[4, 9, 2], [3, 5, 7], [8, 1, 6]],
[[6, 1, 8], [7, 5, 3], [2, 9,... | StarcoderdataPython |
3234724 | import os
import string
import json
import requests
from tqdm import tqdm
import os.path
from os import path
import pickle
import argparse
import pandas as pd
import numpy as np
import gensim
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from gensim.models.callbacks import CallbackAny2Vec
from sklearn.me... | StarcoderdataPython |
158915 | class DiscordParseException(Exception):
"""An exception that is thrown when parsing Discord's representation of a channel / role / user mention fails."""
def parse_discord_str(content_str: str, type_chars: str) -> int:
"""Parses Discord's representation of a channel / role / user mention into an ID."""
if ... | StarcoderdataPython |
1755285 | # imgur key
client_id = 'YOUR_IMGUR_CLIENT_ID'
client_secret = 'YOUR_IMGUR__CLIENT_SECRET'
album_id = 'YOUR_IMGUR_ALBUM_ID'
access_token = 'YOUR_IMGUR_ACCESS_TOKEN'
refresh_token = 'YOUR_IMGUR_ACCESS_TOKEN'
# line bot key
line_channel_access_token = '<KEY>
line_channel_secret = '3b1a6196ac1e2c07c215023f0287be4b'
| StarcoderdataPython |
1616104 | <reponame>sd-EvandroLippert/web_scrapper
from typing import Dict, List
import requests
from bs4 import BeautifulSoup
from requests.models import Response
import base64
class Scraper:
"""
Classe para a realização do scrapper no site http://free-proxy.cz/en/main/
"""
base_url: str = "http://free-proxy... | StarcoderdataPython |
3351447 | """
This module generates Inverse Discrete Hartley Transform matrix (IDHT). |br|
Frequencies represented by the rows of the generated IDHT matrix:
freq. (cos) (sin)
^ /. /.
| / . / .
| / . / .
| / . / .
| / . / .
|... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.