id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
9711461 | <reponame>zinaukarenku/zkr-platform
# Generated by Django 2.1.1 on 2018-10-11 07:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('questions', '0003_auto_20181011_1044'),
]
operations = [
migrations.Alt... | StarcoderdataPython |
1675626 | <filename>bobstack/tests/test_sipmessaging_sipResponse.py
from abstractSIPResponseTestCase import AbstractSIPResponseTestCase
from ..sipmessaging import SIPResponse
class TestSIPResponse(AbstractSIPResponseTestCase):
@property
def status_code(self):
return 100
@property
def reason_phrase(self... | StarcoderdataPython |
6590875 | <reponame>ptoman/SimpleML<gh_stars>10-100
"""Empty Database
Revision ID: 0680f18b52ca
Revises:
Create Date: 2019-01-22 20:10:03.581025
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alem... | StarcoderdataPython |
59473 | # foo
# <caret>
pass | StarcoderdataPython |
6665975 | """ Signals used by the app. """
__author__ = "<NAME>"
__date__ = "2018-03-14"
__copyright__ = "Copyright 2019 United Kingdom Research and Innovation"
__license__ = "BSD - see LICENSE file in top-level package directory"
from django.conf import settings
from django.db.models.signals import post_save
from django.disp... | StarcoderdataPython |
1801101 | <reponame>take2rohit/monk_v1<filename>monk/tf_keras_1/transforms/transforms.py<gh_stars>100-1000
from monk.tf_keras_1.transforms.imports import *
from monk.system.imports import *
@accepts(dict, [list, float, int], [list, float, int], [list, float, int], [list, float, int], bool, bool, bool, retrieve=bool, post_tra... | StarcoderdataPython |
3567838 | <reponame>destenson/ethereum-pyethereum
import os
import ethereum.testutils as testutils
from ethereum.slogging import get_logger
import ethereum.abi as abi
logger = get_logger()
def test_abi_encode_var_sized_array():
abi.encode_abi(['address[]'], [[b'\x00' * 20] * 3])
def test_abi_encode_fixed_size_array():
... | StarcoderdataPython |
11211606 | #!/python3/bin/python3
def do_twice(f,m):
f(m)
f(m)
def print_spam(test):
print(test)
def print_twice(bruce):
print(bruce)
print(bruce)
do_twice(print_spam,'hello')
| StarcoderdataPython |
1815442 | import re
import logging
from osmosis import sh
def dfPercent(location):
output = sh.run(["df", location])
try:
line = " ".join(output.split("\n")[1:])
return int(re.split(r"\s+", line)[4].strip("%"))
except Exception:
logging.exception("Unable to parse DF output:\n%(output)s", dic... | StarcoderdataPython |
6615396 | <filename>isbi_model_predict.py
# Imports
import os
import matplotlib.pyplot as plt
import _pickle as cPickle
import numpy as np
import cv2
import time
# Keras Imports
from keras.applications import VGG16
from keras.applications.vgg16 import preprocess_input
from keras.models import Model, load_model
from keras.layer... | StarcoderdataPython |
223167 | import serial
import sys
import glob
#serialDevice = '/dev/tty.usbmodem12341'
serialDevice = '/dev/ttyUSB0'
def serial_ports():
""" Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
:returns:
A list of the serial ports available on... | StarcoderdataPython |
8016390 | import numpy as np
from chairs import sample, sample2, waiting_area
def map_area(data):
return np.array([[np.nan if c == "." else 0 for c in row] for row in data.split("\n")])
def analyze_chairs(m):
"""Iterate through the room & build two lists of indices.
Use a rolling window to search for empty chairs... | StarcoderdataPython |
11337508 | <gh_stars>0
from main import Pygame, Element, Image
import time
ballGif = "ball.gif"
def main():
global count
count += 1
if ball.detectCollision(collide) and count >= 300:
pg.remove(collide)
time.sleep(0.5)
print(ball.detectCollision(collide), count)
with Pygame() as pg:
count = 0... | StarcoderdataPython |
6517449 | <reponame>gitter-badger/turbulette
import logging
from ariadne import convert_kwargs_to_snake_case
from tests.app_1.models import Book, Comics
from tests.app_1.pyd_models import CreateBook, CreateComics
from turbulette import mutation, query
from turbulette.apps.auth import get_token_from_user, user_model
from turbul... | StarcoderdataPython |
4895555 | import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import tensorflow as tf
import lib.graphprot_dataloader, lib.rna_utils
from Model.Joint_ada_sampling_model import JointAdaModel
from lib.general_utils import Pool
import multiprocessing as mp
import pandas as pd
tf.logging.set_verbosity(tf.logging.F... | StarcoderdataPython |
8139404 | # -*- coding: utf-8 -*-
import scrapy
import pdb, datetime
class projectorItem(scrapy.Item):
Brand = scrapy.Field()
Name = scrapy.Field()
Price = scrapy.Field()
Uri = scrapy.Field()
ImageUri = scrapy.Field()
Ratings = scrapy.Field()
... | StarcoderdataPython |
232638 | import komand
from .schema import ViewSavedSearchPropertiesInput, ViewSavedSearchPropertiesOutput
# Custom imports below
class ViewSavedSearchProperties(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='view_saved_search_properties',
descripti... | StarcoderdataPython |
170091 | import numpy as np
import warnings
from time import time
import pandas as pd
# SeldonianML imports
from utils import argsweep, experiment, keyboard
from datasets import tutoring_bandit as TutoringSystem
import core.srl_fairness as SRL
import baselines.naive_full as NSRL
# Supress sklearn FutureWarnings for SGD
warni... | StarcoderdataPython |
11283330 | <gh_stars>1-10
import Tkinter
from scato.scheduler import Scheduler
class DrawArea:
'''Interface:
area = DrawArea(tk_root_element)
# area.compensation_mode = True # for MS Windows
area.bg(color)
area.bd(color)
area.line((x1, y1, x2, y2), width, color)
# if area.compensa... | StarcoderdataPython |
8111370 | <gh_stars>1-10
from bs4 import BeautifulSoup
import requests
from requests.api import request
from .models import Marks
from main.anlysis import analysis
hrefa=[]
title=[]
data=[]
dicts={}
fintit=[]
finhref=[]
finscr=[]
def scrapnews(user):
url="https://www.goodnewsnetwork.org/category/news/"
html_doc=request... | StarcoderdataPython |
6577430 | <filename>builders/frontend_builder.py<gh_stars>1-10
import tensorflow as tf
from tensorflow.contrib import slim
from frontends import xception
import os
def build_frontend(inputs, frontend, is_training=True, pretrained_dir="models"):
if frontend == 'ResNet50':
with slim.arg_scope(resnet_v2.resnet_arg_sc... | StarcoderdataPython |
1712728 | <gh_stars>10-100
# Copyright (c) 2020 <NAME>
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
from google.cloud.bigquery.table import Table as BQTable
from google.cloud.bigquery.table import TimePartitioning
from bq_test_kit.bq_dsl.bq_resources.partitions import TimeField
fro... | StarcoderdataPython |
11216097 | # Created by MechAviv
# ID :: [927020060]
# Hidden Street : Black Mage's Antechamber
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setSpeakerID(0)
sm.removeEscapeButton()
sm.flipDialoguePlayerAsSpeaker()
sm.setSpeakerType(3)
sm.sendNext("Looks like Freud and... | StarcoderdataPython |
85256 | <filename>hospital/admin.py
from django.contrib import admin
# Register your models here.
from hospital.models import Doctor, Patient, Appointment, PatientDischargeDetails
class DoctorAdmin(admin.ModelAdmin):
pass
admin.site.register(Doctor, DoctorAdmin)
class PatientAdmin(admin.ModelAdmin):
pass
admin... | StarcoderdataPython |
6409150 | <reponame>Sposigor/Caminho_do_Python
from datetime import date
ano = int(input('Ano de nascimento: '))
g = input('Masculino ou Femino [M/F]').strip().upper()
print(f'Quem nasceu em {ano} tem {date.today().year - ano} em {date.today().year}')
if g == 'M':
if date.today().year - ano < 18:
print(f'Falta {(18 -... | StarcoderdataPython |
238621 | <gh_stars>0
# Author: <NAME>
# Module: Emerging Technologies
# Date: September, 2017
# Problem Sheet: https://emerging-technologies.github.io/problems/python-fundamentals.html
# create a function to reverse a string
def reverse():
word = input("Enter a string: ") #user enters a string and store it in word
wor... | StarcoderdataPython |
5150524 | <reponame>wladimir-crypto/TensowFlow-Food
# Copyright 2020 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/... | StarcoderdataPython |
385284 | <reponame>plaza-project/plaza-toggl-bridge
from sqlalchemy import Column, Integer, String, MetaData, Column, ForeignKey, UniqueConstraint, Table
metadata = MetaData()
TogglUserRegistration = Table(
'TOGGL_USER_REGISTRATION', metadata,
Column('id', Integer, primary_key=True, autoincrement=True),
Column('to... | StarcoderdataPython |
8077268 | <gh_stars>1000+
# 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 Generator... | StarcoderdataPython |
5090835 | <gh_stars>1-10
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 |
278810 | <reponame>bcgov/registries-search<filename>search-api/src/search_api/resources/v1/ops.py
# Copyright © 2022 Province of British Columbia
#
# 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 |
338604 | from output.models.nist_data.atomic.g_day.schema_instance.nistschema_sv_iv_atomic_g_day_min_inclusive_1_xsd.nistschema_sv_iv_atomic_g_day_min_inclusive_1 import NistschemaSvIvAtomicGDayMinInclusive1
__all__ = [
"NistschemaSvIvAtomicGDayMinInclusive1",
]
| StarcoderdataPython |
114844 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Clione Software
# Copyright (c) 2010-2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | StarcoderdataPython |
34013 | #!/usr/bin/python3
m1 = int(input("Enter no. of rows : \t"))
n1 = int(input("Enter no. of columns : \t"))
a = []
print("Enter Matrix 1:\n")
for i in range(n1):
row = list(map(int, input().split()))
a.append(row)
print(a)
m2 = int(n1)
print("\n Your Matrix 2 must have",n1,"rows and",m1,"columns \n")
n2 ... | StarcoderdataPython |
1876369 | <gh_stars>0
'''
Created on 25 Dec 2016
@author: dusted-ipro
Contains callable data structures for all social link types
'''
def allLinks():
'''
All Link Types (Agent <-> Agent, Agent<-->Clan, Clan<-->Clan)
CAUTION: Index Order is used for internal functions!
::returns Dict All types
'''
retu... | StarcoderdataPython |
6573490 | <filename>Puzzles/Easy/DetectivePikaptcha.Ep1.py
import sys
import math
import itertools
CHANGES = [(0,1),(1,0),(0,-1),(-1,0)]
# Read inputs
width, height = (int(i) for i in input().split())
map = [[c for c in input()] for i in range(height)]
def getCase(i, j):
if i < 0 or j < 0 or i >= height or j >= width:
... | StarcoderdataPython |
3313375 | <gh_stars>0
import re
from collections import Counter
def count_words(word_str):
words = Counter(re.findall(r"\b[\w'-]+\b", word_str.lower()))
return dict(words)
| StarcoderdataPython |
9767416 | <reponame>Skydler/skulpt<filename>src/lib/pedal/plugins/check_references.py
# Runner
from pedal.report.imperative import clear_report
import sys
import os
from io import StringIO
from contextlib import redirect_stdout
import unittest
from unittest.mock import patch, mock_open
# Arguments
GRADER_PATH = sys.argv[1]
REFE... | StarcoderdataPython |
1816095 | <filename>src/features/fre_to_tpm/viirs/ftt_plume_tracking.py<gh_stars>0
# load in required packages
import glob
import os
from datetime import datetime, timedelta
import logging
import re
import numpy as np
from scipy import ndimage
import cv2
from shapely.geometry import Point, LineString
import src.data.readers.lo... | StarcoderdataPython |
3405480 | <filename>functions/erp-transform-file/func.py<gh_stars>1-10
# Copyright (c) 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
import logging
import io
import json
import oci.object_storage
from fdk import response
import erp_... | StarcoderdataPython |
11216794 | # Operator overloading example
import example
a = example.Complex(2, 3)
b = example.Complex(-5, 10)
print "a =", a
print "b =", b
c = a + b
print "c =", c
print "a*b =", a * b
print "a-c =", a - c
e = example.ComplexCopy(a - c)
print "e =", e
# Big expression
f = ((a + b) * (c + b * e)) + (-a)
print "f =... | StarcoderdataPython |
3476124 | <filename>hex_raster_processor/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Top-level package for Raster Processor."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.9'
| StarcoderdataPython |
4876318 | from PyMySQLLock import Locker
def test_get_lock_success(mysql_conn_params, mysql_connectors):
for connector in mysql_connectors:
mysql_conn_params["mysql_lib_connector"] = connector
locker = Locker(**mysql_conn_params)
l = locker.lock("test")
ret = l.acquire(refresh_interval_secs=... | StarcoderdataPython |
9735160 | <filename>Lib/objc/_BiometricKit.py
"""
Classes from the 'BiometricKit' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
BKErrorHelper = _Cl... | StarcoderdataPython |
11307017 | <gh_stars>100-1000
from clpy.manipulation.join import * # NOQA
| StarcoderdataPython |
5144185 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Let's play a game called "PIG".
+-----------------------------------------------------------+
| There are 2 players: You and the opponent. |
| |
| Players take turns to roll a di... | StarcoderdataPython |
3473056 | <gh_stars>0
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name' : 'Invoicing',
'version' : '1.1',
'summary': 'Invoices & Payments',
'sequence': 15,
'description': """
Invoicing & Payments
====================
The specific and easy-to-use Invoic... | StarcoderdataPython |
8067151 | <gh_stars>0
def func(n):
for num in range(2, n):
prime = True
for i in range(2, num):
if (num % i == 0):
prime = False
if prime:
print(num)
func(10) | StarcoderdataPython |
3368300 | <filename>greykite/common/time_properties_forecast.py
# BSD 2-CLAUSE LICENSE
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this
# list of condit... | StarcoderdataPython |
1625002 | <filename>sample_AIs/python27.py
# posting to: http://localhost:3000/api/articles/update/:articleid with title, content
# changes title, content
#
# id1: (darwinbot1 P@ssw0rd!! 57d748bc67d0eaf026dff431) <-- this will change with differing mongo instances
import time # for testing, this is not good
import requests # if ... | StarcoderdataPython |
12832604 | <filename>api/File.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Turku University (2019) Department of Future Technologies
# Course Virtualization / Website
# Class for Course Virtualization site downloadables
#
# File.py - <NAME> <<EMAIL>>
#
# 2019-12-07 Initial version.
# 2019-12-28 Add prepublish(), J... | StarcoderdataPython |
3396099 | #!/usr/bin/env python
# coding: utf-8
# # [Mempersiapkan Library](https://academy.dqlab.id/main/livecode/293/560/2797)
# In[2]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
from kmodes.kmodes import KModes
from kmodes.kprototyp... | StarcoderdataPython |
4945406 | <reponame>karansthr/apistar
import re
from urllib.parse import urljoin
from apistar import validators
from apistar.compat import dict_type
from apistar.document import Document, Field, Link, Section
from apistar.schemas.jsonschema import JSON_SCHEMA, JSONSchema
SCHEMA_REF = validators.Object(
properties={'$ref': ... | StarcoderdataPython |
6484093 | <filename>authserver/config/__init__.py
from authserver.config.config import AbstractConfiguration, ConfigurationFactory, ConfigurationEnvironmentNotFoundError
| StarcoderdataPython |
8058477 | import os
from zygoat.constants import Projects
from zygoat.components import FileComponent
from . import resources
class Configuration(FileComponent):
filename = "cypress.json"
resource_pkg = resources
base_path = os.path.join(Projects.FRONTEND)
configuration = Configuration()
| StarcoderdataPython |
6549382 | #Python modules
###wrapper for subprocess command
def runsubprocess(args,verbose=False,shell=False,polling=False,printstdout=True,preexec_fn=None):
"""takes a subprocess argument list and runs Popen/communicate or Popen/poll() (if polling=True); if verbose=True, processname (string giving command call) is printed ... | StarcoderdataPython |
9769694 | # ~ from pytokr import get_tok, get_toks
def make_tokr(f = None):
"make iterator and next functions out of iterable of split strings"
from itertools import chain
def sp(ln):
"to split the strings with a map"
return ln.split()
def the_it():
"so that both, items and item, are c... | StarcoderdataPython |
1686518 | <reponame>ngokevin/chili
from cyder.dnsutils.tests.include_forward import *
from cyder.dnsutils.tests.include_reverse import *
from cyder.dnsutils.tests.soa import *
| StarcoderdataPython |
3325103 | <gh_stars>10-100
from django.conf.urls import url
from input_forms import views
urlpatterns = [
url(r"^$", views.index,
name="index"),
url(r"^create$", views.create,
name="create"),
url(r"^update", views.update,
name="update"),
url(r"^search$", views.search,
name="sear... | StarcoderdataPython |
4827848 | import numpy as np
reveal_type(np.Inf) # E: float
reveal_type(np.Infinity) # E: float
reveal_type(np.NAN) # E: float
reveal_type(np.NINF) # E: float
reveal_type(np.NZERO) # E: float
reveal_type(np.NaN) # E: float
reveal_type(np.PINF) # E: float
reveal_type(np.PZERO) # E: float
reveal_type(np.e) # E:... | StarcoderdataPython |
3494326 | <filename>python/bayesian_nn.py
import theano.tensor as T
import theano
import numpy as np
from scipy.spatial.distance import pdist, squareform
import random
import time
'''
Sample code to reproduce our results for the Bayesian neural network example.
Our settings are almost the same as Hernandez-Lobato and Ad... | StarcoderdataPython |
8182331 | ## @package onnx
#Module caffe2.python.onnx.onnxifi
"""
ONNXIFI a Caffe2 net
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core, workspace
import ca... | StarcoderdataPython |
11222131 | <gh_stars>1-10
from typing import List
from pdip.data import Entity
from sqlalchemy import Column, String
from sqlalchemy.orm import relationship
from process.domain.base import Base
from process.domain.base.connection.ConnectionTypeBase import ConnectionTypeBase
from process.domain.connection.Connection import Conne... | StarcoderdataPython |
1618077 | <filename>object_detection.py
# -*- coding: utf-8 -*-
#
# 对象检测
# Author: alex
# Created Time: 2018年11月24日 星期六 10时01分39秒
from imageai.Prediction.Custom import CustomImagePrediction
output_path = '/tmp/'
json_path = '/var/www/tmp/faces/model/json/model_class.json'
model_path = '/var/www/tmp/faces/model/models/model_ex-1... | StarcoderdataPython |
11297713 | <reponame>jkosinski/XlinkAnalyzerX<filename>template/cmd.py
# vim: set expandtab shiftwidth=4 softtabstop=4:
def subcommand_function(session, positional_arguments, keyword_arguments):
pass
from chimerax.core.commands import CmdDesc
subcommand_desc = CmdDesc()
# TODO: Add more subcommands here
| StarcoderdataPython |
168531 | <reponame>netor27/codefights-arcade-solutions<gh_stars>0
def extractEachKth(inputArray, k):
return [x for i, x in enumerate(inputArray) if (i + 1) % k != 0]
print(extractEachKth([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3)) | StarcoderdataPython |
11265169 | <reponame>ehsanik/allenact<gh_stars>0
import glob
import os
from math import ceil
from typing import Dict, Any, List, Optional, Sequence
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import LambdaLR
from torchvision import models
from consta... | StarcoderdataPython |
1966612 | #! /usr/bin/env python3
import itertools
import sys
def find_clouds(lst: list) -> int:
xs = [int(x[0][0]) for x in lst] + [int(x[1][0]) for x in lst]
max_x = max(xs)
ys = [int(x[0][1]) for x in lst] + [int(x[1][1]) for x in lst]
max_y = max(ys)
sea_map = {}
for x in range(0, max_x + 1):
... | StarcoderdataPython |
281766 | """
Multiclass-classification by taking the max over a set of one-against-rest
logistic classifiers.
"""
__authors__ = "<NAME>"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["<NAME>"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "<EMAIL>"
import logging
try:
f... | StarcoderdataPython |
6508701 | from __future__ import division
from mdp_gen import gen_multi_reward_params, multi_reward_grid_mdp, multiple_grid_mdp, \
write_spudd_model, multiple_bernoulli_mdp, multiple_r_and_d_mdp
from mdp_base import MultipleMDP
from factored_alp import factored_alp, eval_approx_qf
import search
reload(search)
from search im... | StarcoderdataPython |
15162 | import logging
import os
import re
import sublime
# external dependencies (see dependencies.json)
import jsonschema
import yaml # pyyaml
# This plugin generates a hidden syntax file containing rules for additional
# chainloading commands defined by the user. The syntax is stored in the cache
# directory to avoid the... | StarcoderdataPython |
11349778 | <filename>No_0993_Cousins in Binary Tree/by_level_order_traversal.py<gh_stars>10-100
'''
Description:
In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1.
Two nodes of a binary tree are cousins if they have the same depth, but have different parents.
We are given the ro... | StarcoderdataPython |
1867649 | <gh_stars>1-10
import discord
from discord.ext import commands
import youtube_dl
import asyncio
from itertools import cycle
import datetime
from dateutil.relativedelta import relativedelta
import urllib.request
import random
if not discord.opus.is_loaded():
# the 'opus' library here is opus.dll on windows
# or... | StarcoderdataPython |
3528485 | # -*- coding: utf-8 -*-
import os
import sys
import json
import pkg_resources
from pathlib import Path
import pandas as pd
from findy.utils.log import init_log
sys.setrecursionlimit(1000000)
pd.options.compute.use_bottleneck = True
pd.options.compute.use_numba = False
pd.options.compute.use_numexpr = True
pd.set_op... | StarcoderdataPython |
3434272 | """
Maximum density still life in cpmpy.
CSPLib 032: http://www.csplib.org/prob/prob032
'''
Proposed by <NAME>
This problem arises from the Game of Life, invented by <NAME> in the 1960s and
popularized by <NAME> in his Scientific American columns.
Life is played on a squared board, considered to extend to infinity i... | StarcoderdataPython |
11266377 | <gh_stars>0
# Given an integer n, return the number of trailing zeroes in n!.
# Must be logarithmic time complexity.
class Solution:
# @return an integer
def trailingZeroes(self, n):
if n < 5:
return 0
else:
new_num = n // 5
return new_num + self.trailingZero... | StarcoderdataPython |
1984808 | <filename>main.py
from rnn import RNN as Rnn
import numpy as np
from dataset import Dataset
def run_language_model(dataset, max_epochs, hidden_size=100, sequence_length=30, learning_rate=1e-1, sample_every=100):
vocab_size = len(dataset.sorted_chars)
RNN = Rnn(vocab_size, hidden_size, sequence_length, learnin... | StarcoderdataPython |
324491 | <gh_stars>1-10
'''
Created on Sep 21, 2017
@author: <NAME>
'''
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from Video3_MainWindow_Complex_7_FINAL_UI import Ui_MainWindow
class MainWindow_EXEC():
def __init__(self):
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidg... | StarcoderdataPython |
4860649 | <reponame>alex/effect
"""
A system for helping you separate your IO and state-manipulation code
(hereafter referred to as "effects") from everything else, thus allowing
the majority of your code to be trivially testable and composable (that is,
have the general benefits of purely functional code).
TODO: an effect impl... | StarcoderdataPython |
5199537 | #!/usr/bin/env python
import os
import sys
import yaml
def dir_to_dict(path):
directory = {}
for dirname, dirnames, filenames in os.walk(path):
dn = os.path.basename(dirname)
directory[dn] = []
if dirnames:
for d in dirnames:
directory[dn].append(dir_to_... | StarcoderdataPython |
5097696 | """AVM Fritz!Box connectivitiy sensor."""
from collections import defaultdict
import datetime
import logging
try:
from homeassistant.components.binary_sensor import (
ENTITY_ID_FORMAT,
BinarySensorEntity,
)
except ImportError:
from homeassistant.components.binary_sensor import (
ENT... | StarcoderdataPython |
1905982 | <filename>transformations2log/__init__.py
from transformations2log.transformations2log import transformations2log
| StarcoderdataPython |
4866237 | def sample_trajectories_train(env, N, m, l, g, build_dics_func):
dicts_in_static = []
dicts_in_dynamic = []
dicts_out_static = []
dicts_out_dynamic = []
state = env.reset()
while (len(dicts_in_static) < N):
for i in range(100):
action = env.action_space.sample()
next_s... | StarcoderdataPython |
4921821 | from Layers import Layer, EntityLayer
import Things
from Lib import Gen,Vector
import itertools
from random import sample
V=Vector.Vector2
exghosts=[Things.Lazy,Things.Clyde,Things.Crazy]
class Level(object):
backcol=(0,0,0)
scale=1
cpairs=[("Enemies","Players"),("Dots","Players")]
jscores=None
def ... | StarcoderdataPython |
3289541 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
""" A WebIDL parser. """
from ply import lex, yacc
import re
import os
import traceback
# Machinery
def parseInt(lite... | StarcoderdataPython |
6525070 | <reponame>xinlc/selenium-learning<gh_stars>0
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time i... | StarcoderdataPython |
5019549 | from collections import deque
import numpy as np
import matplotlib.pyplot as plt
from .layers import *
from .visualizer import Visualizer
class Model:
"""The Neural Net."""
def __init__(self, inputs, outputs):
self.inputs = inputs
self.outputs = outputs
def compile(self, optimizer, los... | StarcoderdataPython |
4864026 | # @Author: <NAME>@2022
# String/Char Variable Literal Examples
strings = "hello world"
char = "h"
multilineString = """Hello World \
Hello World"""
uniCode = u"\u0048\u0065\u006c\u006c\u006f \u0057\u006f\u0072\u006c\u0064"
rawString = "Hello \n World"
if __name__ == '__main__':
print(strings)
print(char)
pr... | StarcoderdataPython |
334800 | <reponame>rbiswas4/utils<gh_stars>0
#!/usr/bin/env python
"""
module to help in plotting.
Functions:
inputExplorer: slider functionality to help in exploring functions
drawxband : drawing shaded regions of specific width around a value,
helpful in ratio/residual plots
settwopanel : returns a figure and axe... | StarcoderdataPython |
3374365 | <gh_stars>0
# Generated by Django 3.0.8 on 2020-07-26 05:15
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('conferences', '0002_auto_20200725_2215'),
('review'... | StarcoderdataPython |
17976 | from pyramid.httpexceptions import HTTPConflict
from h.auth.util import client_authority
from h.presenters import TrustedUserJSONPresenter
from h.schemas import ValidationError
from h.schemas.api.user import CreateUserAPISchema, UpdateUserAPISchema
from h.services.user_unique import DuplicateUserError
from h.views.api... | StarcoderdataPython |
9758345 | import os
import platform
import sys
IS_WINDOWS = platform.system() == 'Windows' or os.name == 'nt'
IS_PYTHON2 = sys.version_info.major == 2 or sys.version < '3'
IS_PYTHON35_UP = sys.version >= '3.5'
BASESTRING = basestring if IS_PYTHON2 else str
UNICODE = unicode if IS_PYTHON2 else str
LONG = long if IS_PYTHON2 el... | StarcoderdataPython |
5028509 | <gh_stars>0
import abc
from wdim.util import pack
from wdim.orm import fields
from wdim.orm import exceptions
class StorableMeta(abc.ABCMeta):
STORABLE_CLASSES = {}
def __init__(cls, name, bases, dct):
super().__init__(name, bases, dct)
cls._collection_name = cls.__name__.lower()
... | StarcoderdataPython |
15737 | <gh_stars>0
a=''
n=int(input())
while n != 0:
a=str(n%2)+a
n//=2
print(a)
| StarcoderdataPython |
11374648 | <reponame>XanderWander/MasterMind<gh_stars>0
from src.Game import Game
from src.GameData import GameType, Color, Answer, Guess, GameData
from src.View import View, ViewType
from src.Solver import AI, AI_Type
from src.Utils import calc_all_questions, calc_answer | StarcoderdataPython |
5083943 | #!/usr/bin/python
import sys
import argparse
import os
parser = argparse.ArgumentParser(description="Make helper parser")
parser.add_argument("--directory", dest="directory", required=True)
parser.add_argument("--library", dest="library", help="Make a library")
parser.add_argument("--binary", dest="binary", help="Make... | StarcoderdataPython |
3580588 | from django_jinja import library
from olympia.zadmin.models import get_config as zadmin_get_config
@library.global_function
def get_config(key):
return zadmin_get_config(key)
| StarcoderdataPython |
78052 | import datetime
import os
import sys
import traceback
from os.path import expanduser
from shutil import copyfile
import nose.plugins.base
from jinja2 import Environment, FileSystemLoader
from nose.plugins.base import Plugin
class MarketFeatures(Plugin):
"""
provide summery report of executed tests listed per... | StarcoderdataPython |
307844 | #!/usr/bin/env python
import rospy
import math
import tf
from sensor_msgs.msg import JointState
from geometry_msgs.msg import Pose
from tr5_kinematics.srv import DoInverseKinematics, DoInverseKinematicsResponse
# load private parameters
svc_ik = rospy.get_param("~inv_kin_service", "/do_ik")
# DH Parameters fo... | StarcoderdataPython |
8091817 | <gh_stars>1-10
from action import Action
from update_dict import UpdateDict
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.