id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3227393 | <filename>player/python/songs.py
# Song format: Note, octave, length
# C major scale
song1_tempo = 220
song1 = [
["Cn", 2, 1],
["Dn", 2, 1],
["En", 2, 1],
["Fn", 2, 1],
["Gn", 2, 1],
["An", 2, 1],
["Bn", 2, 1],
["Cn", 3, 1],
["Bn", 2, 1],
["An", 2, 1],
["Gn", 2, 1],
["Fn", 2, 1],
["En", 2, 1],
["Dn", 2, ... | StarcoderdataPython |
1630563 | # -*- coding: utf-8 -*-
"""
website.tcp.services
~~~~~~~~~~~~~~~~
TCP Proxy services api.
"""
import os
import sys
import subprocess
from flask import flash, current_app
from flask.ext.babel import gettext
from website.services import exec_command
from website import db
from website.tcp.models import Con... | StarcoderdataPython |
1775530 | <reponame>arterial-io/mesh
from scheme import *
from mesh.standard import *
class Example(Resource):
name = 'example'
version = 1
endpoints = 'create delete get put query update'
class schema:
required = Text(required=True, nonnull=True, sortable=True,
operators=['eq', 'ne', 'pre',... | StarcoderdataPython |
3240428 | <reponame>nerdfiles/jahjah_works<filename>mini_charge/views.py
# -*- coding: utf-8 -*-
from django.template.context import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.http import require_POST
from payments import models
import stripe
def _ajax_response(request, templa... | StarcoderdataPython |
1628479 | <filename>lib/bindings/samples/server/test/test_algorithm_scheduler.py<gh_stars>100-1000
import unittest
from algorithm.algorithm_runner import AlgorithmRunner
from project_manager import ProjectManager
from algorithm.algorithm_scheduler import AlgorithmScheduler
from utils.settings_manager import SETTINGS
TEST_PTV_F... | StarcoderdataPython |
3337392 | <filename>Library/settings.py<gh_stars>0
"""
Django settings for Library project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.c... | StarcoderdataPython |
3224155 | <filename>Basic Programs/tut_10.py<gh_stars>0
# Dictionary is nothing but key value pairs
d1 = {"Ahtisham":"Beaf", "Waleed": "Burger", "Shakir": {"B":"breakfast", "L":"lunch", "D":"Dinner"}, "Naveeda":"Roti"}
print(d1["Ahtisham"])
d1["Ayesha"]= "choclate"
print(d1["Ayesha"])
del d1["Ayesha"]
print(d1)
d2 = d1.copy()
pr... | StarcoderdataPython |
142023 | from typing import Dict
import numpy as np
class ZDataProcessor:
def __init__(self):
self.source_to_index = {
'acoustic': 0,
'electronic': 1,
'synthetic': 2
}
self.quality_to_index = {
'bright': 0,
'dark': 1,
'distort... | StarcoderdataPython |
1647065 | import gevent
from locust.env import Environment
from locust.stats import stats_printer, stats_history
from locust.log import setup_logging
setup_logging("INFO", None)
def create_env(user_class, ip_address="127.0.0.1"):
env = Environment(user_classes=[user_class])
env.create_local_runner()
env.create_web... | StarcoderdataPython |
1606540 | <reponame>ztfmars/OpenCV_Tutorial
# -*- coding: utf-8 -*-
import cv2
a=cv2.imread(r"../image/lena256.bmp",cv2.IMREAD_UNCHANGED)
b=cv2.cvtColor(a,cv2.COLOR_GRAY2BGR)
bb,bg,br=cv2.split(b)
cv2.imshow("bb",bb)
cv2.imshow("bg",bg)
cv2.imshow("br",br)
cv2.waitKey()
cv2.destroyAllWindows() | StarcoderdataPython |
123471 | <gh_stars>1-10
import functools
import logging
import time
import traceback
def debug_func(func, _cls=None): # pragma: no cover
"""
Decorator: applies set of debug features (such as logging and performance counter) to a function
"""
@functools.wraps(func)
def wrapper(*args, **kwargs):
tr... | StarcoderdataPython |
4810040 | # -*- coding: utf-8 -*-
"""English language translation
.. module:: client.plugins.gitclient.translation.en.messages
:platform: Windows, Unix
:synopsis: English language translation
.. moduleauthor:: <NAME> <<EMAIL>>
"""
language = {
'name': 'English',
'ISO-639-1': 'en'
}
msg = {
'htk_gitclient_me... | StarcoderdataPython |
1669241 | from graphviz import Digraph
colors = ["#ff7675", "#fdcb6e", "#74b9ff", "#a29bfe", "#fd79a8", "#81ecec"]
def get_all_names(data):
result = set(data.keys())
for value in data.values():
result.update(value.keys())
return result
def get_charity_names(data):
return sorted(list(set(get_all_names(d... | StarcoderdataPython |
142087 | """
WSGI config for todolist project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/djan... | StarcoderdataPython |
1658692 | """bc URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based view... | StarcoderdataPython |
4823845 | <filename>xcube/core/gen2/generator.py
# The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# 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 re... | StarcoderdataPython |
156878 | <gh_stars>0
from scene_generator import generate_scene, clean_object
def find_object(id, obj_list):
for obj in obj_list:
if obj['id'] == id:
return obj
return None
def test_generate_scene_target_enclosed():
for _ in range(20):
scene = generate_scene('test', 'interaction', Fal... | StarcoderdataPython |
3317835 | import unittest
from scapy.layers.ntp import NTPHeader
from cp1_client import CP1Client
from cp1_helper import generate_address_hash, generate_version_hash
from cp1_package import CP1Package
from cp1_session import CP1Session
from ntp_utils import bit_to_long
from test_constants import KEY_BITS_192
_first_32_bit = '... | StarcoderdataPython |
160248 | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from azure.ai.ml._schema.core.fields import NestedField
from marshmallow import post_load
from azure.ai.ml.constants import AutoMLConstants... | StarcoderdataPython |
3293573 | <gh_stars>0
from flask_sqlalchemy import SQLAlchemy
from gspackage.flask_sqlalchemy_mysql import config
def init_db(app):
app.config.from_object(config)
db = SQLAlchemy()
db.init_app(app)
return db
| StarcoderdataPython |
1748464 | from typing import Tuple
import gdb
class ASTSelectQueryPrinter:
def __init__(self, val: gdb.Value) -> None:
self.val: gdb.Value = val
def to_string(self) -> str:
eval_string = "info vtbl (*("+str(self.val.type).strip('&')+" *)("+str(self.val.address)+"))"
#example: "info vtbl (*(DB::I... | StarcoderdataPython |
4830711 | import os
import cv2
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import argparse
import segmentation_models_v1 as sm
sm.set_framework('tf.keras')
from unet_std import unet # standard unet architecture
from helper_function import plot_deeply_history, plot_history, save_history
from helpe... | StarcoderdataPython |
78673 | <filename>test/mynet.py
import os
import torch
import torch.nn as nn
import torch.optim as optim
from flearn.client import net
class MyNet(net):
def __init__(self, model_fpath, init_model_name):
super(MyNet, self).__init__(model_fpath, init_model_name)
self.criterion = nn.CrossEntropyLoss()
... | StarcoderdataPython |
101153 | import sys
from postagger.utils.classifier import MaximumEntropyClassifier
from postagger.utils.common import timeit, get_data_path
from postagger.utils.common import get_tags
from postagger.utils.preprocess import load_save_preprocessed_data
from postagger.utils.decoder import CompData
from postagger.utils.classifier ... | StarcoderdataPython |
3311734 | <reponame>felipeaugustogudes/devito
#==============================================================================
# -*- encoding: utf-8 -*-
#==============================================================================
#==============================================================================
# Módulos Importa... | StarcoderdataPython |
4815475 | <filename>Gioco/main.py<gh_stars>0
import pygame
import os
from Network import Connessione
from SchermataPrincipale import *
import webbrowser
pygame.init()
if __name__ == "__main__":
FINESTRA = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
SCREEN_WIDTH, SCREEN_HEIGHT = pygame.display.get_surface().get_size()
... | StarcoderdataPython |
1641752 | #!/usr/bin python3
from io import StringIO
from functools import lru_cache, partial
from datetime import datetime
from json import dumps
from pandas import read_csv, concat, DataFrame
from storage import StorageClient
from msoa_etl_db.processor import dry_run
@lru_cache()
def get_msoa_poplation():
with Storage... | StarcoderdataPython |
129698 | <filename>smart_event/settings/common.py
# Python imports
from os.path import abspath, basename, dirname, join, normpath
from django.contrib import messages
import sys
# ##### PATH CONFIGURATION ################################
# fetch Django's project directory
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# f... | StarcoderdataPython |
1749803 | <reponame>shishaochen/TensorFlow-0.8-Win
"""Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
from google.protobuf import text_format
from tensorflow.core.framework import op_def_pb2
from tensorflow.python.framework import op_def_registry
from tensorflow.python.framework import ops
from ... | StarcoderdataPython |
3399783 | <reponame>bjuergens/NaturalNets
import abc
import attr
import numpy as np
from typing import Callable
registered_brain_classes = {}
def get_brain_class(brain_class_name: str):
if brain_class_name in registered_brain_classes:
return registered_brain_classes[brain_class_name]
else:
raise Runtim... | StarcoderdataPython |
1763641 | """
Name: <NAME>
Class: CS370
Date: 13/12/216
Model: major.py
"""
from ferris import BasicModel
from google.appengine.ext import ndb
class Major(BasicModel):
college = ndb.StringProperty();
department = ndb.StringProperty();
link = ndb.StringProperty();
degree_level = ndb.StringPropert... | StarcoderdataPython |
3228942 | class InvalidRessourceException(Exception):
pass
| StarcoderdataPython |
65846 | import numpy as np
from skmultiflow.drift_detection import ADWIN
def demo():
""" _test_adwin
In this demo, an ADWIN object evaluates a sequence of numbers corresponding to 2 distributions.
The ADWIN object indicates the indices where change is detected.
The first half of the data is a sequence ... | StarcoderdataPython |
62122 | <gh_stars>1-10
import librosa
import numpy as np
import os
import pyworld
def world_encode_spectral_envelop(sp, fs, dim=36):
# Get Mel-cepstral coefficients (MCEPs)
#sp = sp.astype(np.float64)
coded_sp = pyworld.code_spectral_envelope(sp, fs, dim)
return coded_sp
def world_decompose(wav, fs, ... | StarcoderdataPython |
4820193 | <reponame>mori-c/cs106a<gh_stars>1-10
"""
File: gameshow.py
------------------
Lets play a gameshow!
"""
def main():
print("Welcome to the CS106A Game Show")
print("Chose a door and pick a prize")
print("-------------")
# PART 1: Get the door number from the user
door = int(input("Do... | StarcoderdataPython |
3311697 | <reponame>sguillory6/e3
import os
from analysis.rrdtool.types.Graph import Graph
class HibernateJmx(Graph):
_graph_config = [
{
'file': '%s-hibernate-collections.png',
'title': 'Hibernate collections on %s',
'label': 'Collection operations',
'stack': True,
... | StarcoderdataPython |
3263107 | # -*- coding: utf-8 -*-
"""
Basic_stat Package for Python
Version 1.0 Nov 29, 2021
Author: <NAME>, Graduate School of Oceanography (GSO), URI.
Email: <EMAIL>
#
# DISCLAIMER:
# This software is provided "as is" without warranty of any kind.
#===============================================... | StarcoderdataPython |
60529 | # -*- coding: utf-8 -*-
import pykintone
from mymodel import Person
from cache import get_all
from jinja2.environment import Environment
from jinja2 import Template, FileSystemLoader
import codecs
import os
import argparse
import unicodecsv as csv
from cStringIO import StringIO
OUTPUT_DIR = './output'
# OUTPUT_DIR =... | StarcoderdataPython |
123671 |
from __future__ import division
import numpy as np
__author__ = '<NAME>'
__license__ = '''Copyright (c) 2014-2017, The IceCube Collaboration
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
... | StarcoderdataPython |
3252513 | # coding=utf-8
# Copyright (c) DIRECT Contributors
import pytest
import torch
from direct.nn.didn.didn import DIDN
def create_input(shape):
data = torch.rand(shape).float()
return data
@pytest.mark.parametrize(
"shape",
[
[3, 2, 32, 32],
[3, 2, 16, 16],
],
)
@pytest.mark.para... | StarcoderdataPython |
3207201 | <gh_stars>0
def conf():
return {
"id":"discourse",
"description":"this is the discourse c360 component",
"enabled":True,
} | StarcoderdataPython |
199637 | import dotdict
import os
import submitit
import sys
from pathlib import Path
from sst.train import train
from global_utils import save_result, search_hyperparams, slurm_job_babysit
meta_configs = dotdict.DotDict(
{
'tagset_size': {
'values': [5],
'flag': None
},
'da... | StarcoderdataPython |
4812579 | <reponame>ryu-sw/alembic
##-*****************************************************************************
##
## Copyright (c) 2009-2011,
## <NAME>, Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All rights reserved.
##
## Redistribution and use in source and binary form... | StarcoderdataPython |
1761736 | import sys
from kubernetes import watch
# This function returns the kubernetes secret object present in a given namespace
def get_kubernetes_secret(api_instance, namespace, secret_name):
try:
return api_instance.read_namespaced_secret(secret_name, namespace)
except Exception as e:
sys.exit("E... | StarcoderdataPython |
3260369 | <reponame>rafaelbarretomg/Uninter
# Exercicio 01 Tuplas da Aula 03
ano = int(input('Digite o ano atual: '))
nasc = int(input('Digite o seu ano de nascimento: '))
idade = ano - nasc
if (idade >= 18):
# Maneira Classica
print('A sua idade é de %i e voce já pode tirar carteira de motorista.' % idade)
# Maneira... | StarcoderdataPython |
4840495 | <reponame>chesfire/ceafa-dms-prod
from django.test import TestCase
from django.test import Client
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.http.response import (
HttpResponseRedirect,
)
from ceafadms.core.models import Tag
User = get_user_model()
class TestTagsV... | StarcoderdataPython |
128317 | #-----------------------------------------------------------------------------
# press-stitch.py
# Merges the three Press Switch games together
# pylint: disable=bad-indentation
#-----------------------------------------------------------------------------
import getopt
import hashlib
import os.path
import pathlib
imp... | StarcoderdataPython |
3206282 | <gh_stars>0
# -*- coding: utf-8 -*-
from deep_neural_network.activation import relu, sigmoid
class ActivationObject(object):
def __init__(self):
self.sigmoid = sigmoid.Sigmoid()
self.relu = relu.ReLU()
| StarcoderdataPython |
1675829 | # https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero
class Solution:
def numberOfSteps(self, num):
ans = 0
while 0 < num:
if num % 2 == 0:
num = num // 2
else:
num -= 1
ans += 1
return ans
| StarcoderdataPython |
4823632 | <gh_stars>0
"""regex_compile a regex pattern to an nfa machine.
"""
import re
import string
from regex.parsing_table import (semantic, all_symbols, grammar,
generate_syntax_table)
from regex.graph import Machine
from regex.regex_nfa import induct_star, induct_or, induct_cat, basis
... | StarcoderdataPython |
1724807 | <reponame>tjgran01/GSR_Concurrent_Recording_Analysis
import neurokit2 as nk
import pickle
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def load_data(data_fpath="./exports/par2.1_finger.csv"):
data = pd.read_csv(data_fpath)
return data
def main():
data = load_data()
print(d... | StarcoderdataPython |
4822786 | <gh_stars>0
#
# This file does not ping the server
#
import glob
from bs4 import BeautifulSoup
sections = glob.glob('output/01-*.txt')
for section in sections:
print('Parsing: {}'.format(section))
section_name = section.split('-')[2].split('.')[0]
section_link_fn = 'output/02-{}_links.txt'.format(sectio... | StarcoderdataPython |
1708132 | <gh_stars>1-10
import pandas as pd
import numpy as np
#import re
import argparse
import sys
import pickle
from cddm_data_simulation import ddm
from cddm_data_simulation import ddm_flexbound
from cddm_data_simulation import levy_flexbound
from cddm_data_simulation import ornstein_uhlenbeck
from cddm_data_simulation imp... | StarcoderdataPython |
3291494 | from app import app
from slack_sdk.errors import SlackApiError
from apps.modal_production_calc.modal_production_calc_helpers import fetch_base_view
from apps.modal_production_calc.modal_production_calc_helpers import get_input_values
from apps.modal_production_calc.modal_production_calc_helpers import create_score_bl... | StarcoderdataPython |
150218 | <reponame>cibu/language-resources
#! /usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lice... | StarcoderdataPython |
1621439 | <reponame>rackerlabs/qonos
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Rackspace
#
# 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.or... | StarcoderdataPython |
138142 | import re
import datetime
from billy.scrape.events import Event, EventScraper
from openstates.utils import LXMLMixin
import pytz
class AKEventScraper(EventScraper, LXMLMixin):
jurisdiction = 'ak'
_TZ = pytz.timezone('US/Alaska')
_DATETIME_FORMAT = '%m/%d/%Y %I:%M %p'
def scrape(self, session, chamb... | StarcoderdataPython |
1768222 | <reponame>pcrete/skil-python
import skil_client
from skil_client.rest import ApiException as api_exception
class WorkSpace:
"""WorkSpace
Workspaces are a collection of features that enable different tasks such as
conducting experiments, training models, and test different dataset transforms.
Workspa... | StarcoderdataPython |
1664062 | from os import listdir
from os.path import isfile, join
from collections import defaultdict
from time import time
class Knapsack:
def __knapsack_topDown(self, number_items, weight_max, values_items, weight_items):
if number_items == 0 or weight_max == 0: return 0
if weight_items[number_items... | StarcoderdataPython |
3262886 | <gh_stars>1-10
# 2019-11-10 15:45:20(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc impo... | StarcoderdataPython |
1669403 | # Vector.py
# Created by <NAME> (2015)
# Custom two-dimentional vector class for easy creation and manipulation of vectors. Contains
# standard arithmetic operations between vectors and coefficients (addition, subtraction, and
# multiplication), as well as a number of handy operations that are commonly used (dot produc... | StarcoderdataPython |
3257998 | import unittest
import time
from minjob.jobs import JobManager
def run_process(with_exception, name="charlie", code="bravo"):
elapsed = 0
while True:
elapsed += 5
time.sleep(5)
if elapsed >= 5:
if with_exception:
raise Exception(f"Terminating process {name}-... | StarcoderdataPython |
3217096 | <filename>simulate.py
import numpy as np
import numpy.random as rng
#rng.seed(0)
NUM_CHANNELS = 5
TOL = 1E-6
def Phi(x):
"""
Softening function
"""
return (x + 1)**(1.0/3.0)
def PhiInv(x):
"""
Inverse
"""
return x**3 - 1.0
def update(m, w):
"""
One iteration of the procedure... | StarcoderdataPython |
3218859 | <filename>tools_py3/setup.py
import setuptools
from os import listdir
from os.path import isfile, join
with open("README.md", "r") as fh:
long_description = fh.read()
script_path='./bin'
stretch_scripts={script_path+'/'+f for f in listdir(script_path) if isfile(join(script_path, f))}
setuptools.setup(
name=... | StarcoderdataPython |
81181 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
result = ListNode(0)
result_tail = result
carry = 0
... | StarcoderdataPython |
1626479 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# <NAME>, <EMAIL>
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.db.models import DeviceUser
from ppmessage.db.models import AppUserData
from ppmessage.core.genericupdate import generic_update
from ppmessa... | StarcoderdataPython |
4827234 | from flask import request, jsonify
from api.index import home_blu
from api.index.utils.handle_json import handle_json
@home_blu.route('/home')
def home():
path = request.args.get('path')
json_dict = handle_json(path)
return jsonify(json_dict)
| StarcoderdataPython |
3368675 | __author__ = '<EMAIL>'
| StarcoderdataPython |
44534 | # Simple XML against XSD Validator for Python 2.7 - 3.2
# to run this script you need additionally: lxml (http://lxml.de)
# author: <NAME>, 2013
import sys
from lxml import etree
xsd_files = []
xml_files = []
def usage():
print("Usage: ")
print("python XSDValidator.py <list of xml files> <list of xsd file... | StarcoderdataPython |
1735687 |
CACHE_PREFIX = "chunk_"
| StarcoderdataPython |
44404 | from system import System
from src.basic.sessions.cmd_session import CmdSession
class CmdSystem(System):
def __init__(self):
super(CmdSystem, self).__init__()
@classmethod
def name(cls):
return 'cmd'
def new_session(self, agent, kb):
return CmdSession(agent, kb)
| StarcoderdataPython |
1705286 | import subprocess
import logging
from subprocess import PIPE
import tempfile
import json, os, re
from github import Github, GithubException
"""
private-www Integration Test CI Hook for Uncle Archie
This hook should be installed into all submodules of private-www.
When a pull request in any of these submodules is upda... | StarcoderdataPython |
31429 | # -*- coding: utf-8 -*-
"""
Spyder Editor
Code written by <NAME> with modifications by <NAME> and <NAME>
This file produces plots comparing our first order sensitivity with BS vega.
"""
# %%
# To run the stuff, you need the package plotly in your anaconda "conda install plotly"
import plotly.graph_objs as go
from... | StarcoderdataPython |
3344684 | #
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#
import logging
import time
class BufferingHandler(logging.StreamHandler):
def __init__(self):
logging.StreamHandler.__init__(self)
self.buffered_log_records = []
self.level = None
def setLevel(s... | StarcoderdataPython |
153654 | <gh_stars>0
"""Utilities to call Git commands."""
import os
import re
import shutil
from contextlib import suppress
import log
from . import common, settings
from .exceptions import ShellError
from .shell import call, pwd
def git(*args, **kwargs):
return call("git", *args, **kwargs)
def gitsvn(*args, **kwarg... | StarcoderdataPython |
50317 | <reponame>UOC/dlkit
"""AuthZ Adapter implementations of osid sessions."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods
# Number of methods are defined in specification
# pylint: disable=too-many-ancestors
# Inheritance defined in specificatio... | StarcoderdataPython |
3341036 | <reponame>ChrisGCampbell/FlyRight
from django.db import models
from django.utils import timezone
class Clearance(models.Model):
clearance_id = models.TextField(primary_key=True)
created_by = models.TextField()
state = models.TextField()
message = models.TextField()
date = models.DateTimeField(defa... | StarcoderdataPython |
108665 | def gcd(a, b):
while b: a, b = b, a % b
return a
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = [2]
for a in L:
t = d
y = pow(a, t, n)
if y == 1: continue
while y != n - 1:
y = (y * y) % n
if y == 1 or t == n - 1: return 0
t ... | StarcoderdataPython |
3334143 | #ind internal-node for-internal-using inherit-from-dict
#anl attr_name_list
import efuntool.efuntool as eftl
from eobj.primitive import *
import types
class Node(dict):
def __init__(self,anl,*args,**kwargs):
'''
nd = Node(['pl'],[['a','b']])
>>> nd.pl
['... | StarcoderdataPython |
1725542 | <reponame>hengchu/fuzzi-impl
import json
import numpy as np
import pkg_resources
import random
import re
import scipy.misc as m
import sys
from mnist import MNIST
from optparse import OptionParser
ORIG_SIZE = 28;
NEW_SIZE = 28;
NUM_PARTITIONS = 10;
#Total number of available samples, can set to less if we don't need... | StarcoderdataPython |
1648053 | # The seek information for our encode
class Seek:
def __init__(self, source_file, ss, to, output_name):
self.source_file = source_file
self.ss = ss
self.to = to
self.output_name = output_name
# The seek string arguments for our encode
def get_seek_string(self):
if le... | StarcoderdataPython |
1760301 | import os
import re
import subprocess
from contextlib import contextmanager
from os.path import expandvars
from pathlib import Path
from typing import Optional, Union
import cpuinfo
import psutil
from codecarbon.external.logger import logger
def is_jetson():
return os.path.isdir('/sys/bus/i2c/drivers/ina3221x/0... | StarcoderdataPython |
191176 | <filename>tankmonitor.py
from threading import Lock, Thread
from tornado.web import Application, RequestHandler, HTTPError
from tornado.httpserver import HTTPServer
from tornado.template import Template
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.gen import coroutine
from tornado.concurrent import ... | StarcoderdataPython |
3328618 | <filename>examples/polygon_plot.py
#!/usr/bin/env python
# This script plots a polygon created from points.
import pdb
import sys
import warnings
import numpy as np
from cornish import ASTPolygon
from cornish import ASTICRSFrame, ASTFrameSet, ASTBox, ASTFITSChannel, ASTCircle, ASTCompoundRegion
import astropy.units... | StarcoderdataPython |
27337 | <reponame>luceatnobis/yt_handle
#!/usr/bin/env python3
from __future__ import print_function
import os
import sys
import shutil
import httplib2
import oauth2client
try:
import apiclient as googleapiclient
except ImportError:
import googleapiclient
from oauth2client.file import Storage, Credentials
from oaut... | StarcoderdataPython |
3314244 | class cc_language:
cc_wrong_arguments = "[USER_ID] you must have forgotten the arguments?"
cc_wrong_game_command = "[USER_ID] you must have mistyped?"
cc_shutdown_bot = "Shut down bot..."
cc_game_already_running = "[USER_ID] there is already a game running. Please wait until this one is over... | StarcoderdataPython |
3310558 | # runs BF on data and saves the best RPN expressions in results.dat
# all the .dat files are created after I run this script
# the .scr are needed to run the fortran code
import csv
import os
import shutil
import subprocess
import sys
from subprocess import call
import numpy as np
import sympy as sp
from... | StarcoderdataPython |
3261304 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
import unicodedata
import codecs
import csv
import cPickle as pickle
import csv
fin = codecs.open("olam-enml.csv", "rb", "utf-8")
malayalam_dict = dict()
pre_data = ""
definition = ""
a=0
for row in fin:
a+=1
print a
data = row.split('\t')
d... | StarcoderdataPython |
73848 | <gh_stars>0
from django.urls import path
from .views import IndexView
app_name = 'home'
urlpatterns = [
path('', IndexView.as_view(), name='indexView')
]
| StarcoderdataPython |
3395936 | <reponame>Dloar/stocks_games
from datetime import datetime
cur_time = datetime.today().strftime('%Y-%m-%d-%H:%M:%S')
print("Currently is " + cur_time)
| StarcoderdataPython |
1617506 | #!/usr/bin/env python3
"""Squid helper for authenticating basic auth against bcrypt hashes.
See Authenticator > Basic Scheme here:
https://wiki.squid-cache.org/Features/AddonHelpers
Designed to work with bcrypt hash files created with htpasswd:
EXAMPLE: htpasswd -cbB -C 10 /path/to/password_file username password
T... | StarcoderdataPython |
870 | import enum
from typing import Union
@enum.unique
class PPT(enum.Enum):
# Source: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppsaveasfiletype
AnimatedGIF = 40
BMP = 19
Default = 11
EMF = 23
External = 64000
GIF = 16
JPG = 17
META = 15
MP4 = 39
OpenPresentati... | StarcoderdataPython |
1657292 | """
np_rw_buffer.buffer
SeaLandAire Technologies
@author: jengel
Numpy circular buffer to help store audio data.
"""
import numpy as np
import threading
from .utils import make_thread_safe
from .circular_indexes import get_indexes
__all__ = ["UnderflowError", "get_shape_columns", "get_shape", "reshape... | StarcoderdataPython |
173014 | <gh_stars>1-10
import logging
from google.appengine.api.taskqueue import Task
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.db import GeoPt
from google.appengine.ext.db import TransactionFailedError
from google.appengine.ext.db import Timeout
from google.appengin... | StarcoderdataPython |
1720736 | import math
import numpy as np
import logging
logger = logging.getLogger('cwl')
class CWLMetric(object):
def __init__(self):
self.expected_utility = 0.0
self.expected_cost = 0.0
self.expected_total_utility = 0.0
self.expected_total_cost = 0.0
self.expected_ite... | StarcoderdataPython |
183377 | # -*- coding: utf-8 -*-
from time import sleep
from requests import get
import utils
print("2bTracker\nuses https://2bqueue.info/\n")
utils.init()
print("Getting 2b2t player lists...")
oldQueuePlayerList = get("https://2bqueue.info/players").json()["queue"]["players"]
oldMainPlayerList = get("https://2bqueue.info/pl... | StarcoderdataPython |
3234655 | #!/usr/bin/python
from __future__ import print_function
import sys
import os
from roundup import instance
dir = os.getcwd ()
tracker = instance.open (dir)
db = tracker.open ('admin')
for id in db.user_dynamic.getnodeids (retired = False) :
dyn = db.user_dynamic.getnode (id)
if dyn.exemption ... | StarcoderdataPython |
3221188 | """Tests for the Bulb API with a socket."""
from typing import AsyncGenerator
import pytest
from pywizlight import wizlight
from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange
from pywizlight.tests.fake_bulb import startup_bulb
@pytest.fixture()
async def socket() -> AsyncGenerator[wizligh... | StarcoderdataPython |
21591 | <filename>Desafio 46.py<gh_stars>0
print('====== DESAFIO 46 ======')
import time
for c in range(10,-1,-1):
time.sleep(1)
print(c) | StarcoderdataPython |
1721059 | from dbacademy.dbrest import DBAcademyRestClient
class ScimServicePrincipalsClient:
def __init__(self, client: DBAcademyRestClient, token: str, endpoint: str):
self.client = client # Client API exposing other operations to this class
self.token = token # The authentication token
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.