id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
1843811 | <gh_stars>1-10
###############################################################################
# tsp_instance.py: data structures and support function to deal with instances
# of the Traveling Salesman Problem.
#
# (c) Copyright 2019, <NAME>. All Rights Reserved.
#
# This code is released under LICENSE.md.
#
# Created ... | StarcoderdataPython |
375793 | <filename>test/test_datapipe.py
import os
import pickle
import random
import tempfile
import warnings
import tarfile
import zipfile
import numpy as np
from PIL import Image
from unittest import skipIf
import torch
import torch.nn as nn
from torch.testing._internal.common_utils import (TestCase, run_tests)
from torch.u... | StarcoderdataPython |
3575744 | <reponame>FloodCamML/FloodCam-WUSFeats<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
## PLS DO NOT EDIT YET - NOT FULLY IMPLEMENTED
# ## A Weakly Supervised Machine Learning Model for Flooded Road Recognition
# ### <NAME>, Marda Science / USGS
# #### May, 2021; contribution to the COMET "Sunny Day Flooding" pr... | StarcoderdataPython |
1832502 | import threading
import time
from copy import deepcopy
import pygame
import game_sound
from Score import Score
from block import TetrisBlock
from features.feature import Feature
from field import Field
from painter import RGB_Field_Painter, Led_Matrix_Painter
from highscorelist import *
lock = threading.Lock()
tetris_... | StarcoderdataPython |
96203 | from keras.layers import Input, Convolution2D, MaxPooling2D, Flatten, Dense
from keras.models import Model
def VGG10(weights=None, input_shape=(128, 128, 3)):
input_img = Input(shape=input_shape)
x = Convolution2D(32, 3, 3, activation='relu', border_mode='same', name='B1_C1')(input_img)
x = Convolution2D... | StarcoderdataPython |
5048682 | <reponame>DougLam/rules_ios<filename>rules/xcodeproj.bzl
load("@build_bazel_rules_apple//apple:providers.bzl", "AppleBundleInfo")
load("@bazel_skylib//lib:paths.bzl", "paths")
def _get_transitive(deps, provider, field):
return [
getattr(dep[provider], field)
for dep in deps
if dep and provi... | StarcoderdataPython |
6622570 | <reponame>stPhoenix/projecttango<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-30 06:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pybb', '0009_account_accountdeletion_emailaddres... | StarcoderdataPython |
6595030 | <gh_stars>0
import os
from functools import lru_cache
from copy import deepcopy
import xmltodict
from .color import Color
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
@lru_cache()
def svg_dict(name):
"""
Turn a svg into a dict structure, and cache requests.
"""
filename = os.path.join(BASE... | StarcoderdataPython |
24767 | <filename>ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/status_params.py
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding co... | StarcoderdataPython |
6683537 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from protobuf.proto.grpcintegration import ControlMessagesProto_pb2 as protobuf_dot_proto_dot_grpcintegration_dot_ControlMessagesProto__pb2
from protobuf.proto.grpcintegration import EventNotificationProto_pb2 as protobuf_dot_proto_dot_g... | StarcoderdataPython |
3355203 | <filename>code/trial/main.py
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.2.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# +
import glob
import os
... | StarcoderdataPython |
9686802 | # -*- coding: utf-8 -*-
TestText="""欧洲央行再次放松其货币政策。欧洲央行周四宣布全面下调三大主要利率。其中,主要再融资利率(即通常所称的主导利率)从原先的0.05%首次降至0%; 边际贷款利率将从0.3%降至0.25%,而边际存款利率则由-0.3%下调10个基点至-0.4%,这意味着银行必须为隔夜存款付更高费用。上述措施将 自3月16日生效。
此外,欧洲央行还宣布将充满争议的每月资产购买规模从600亿欧元扩大至800亿欧元。欧洲央行刚刚在去年12月将此一"量化宽松"措施(简称QE)延长6个月至2017年3月。自今年4月起,欧洲央行每月将购债800亿欧元。
欧洲央行希望通过此一系列措施... | StarcoderdataPython |
1688859 | <filename>test/unit/management_request_result_test.py
from .test_helper import argv_kiwi_tests
import sys
import mock
from mock import patch
from pytest import raises
from azurectl.management.request_result import RequestResult
import azurectl
from collections import namedtuple
from azurectl.azurectl_exceptions impor... | StarcoderdataPython |
12861974 | <filename>pypad/collab.py
from enum import Enum
from .dev import Dev
class Collab(Enum):
UNKNOWN = -1
NONE = 0
RAGNAROK_ONLINE = 1
TAIKO_NO_TATSUJIN = 2
EMIL_CHRONICLE_ONLINE = 3
GUNMA_NO_YABOU = 5
CRYSTAL_DEFENDER = 6
FAMITSU = 7
PRINCESS_PUNT_SWEET = 8
ANDROID = 9
SHINRABA... | StarcoderdataPython |
6424176 | from unittest import TestCase
from grobber.streams.mp4upload import Mp4Upload
from . import BasicStreamTest
class TestMp4Upload(BasicStreamTest, TestCase):
CLS = Mp4Upload
TESTS = [
"https://www.mp4upload.com/embed-h2yq5i3c7xo7.html",
"https://www.mp4upload.com/embed-1934b3ai70n2.html",
... | StarcoderdataPython |
6627698 | <gh_stars>100-1000
import numpy as numpy
import cv2
class Canvas:
#IMAGES_ACROSS = 32
#IMAGES_DOWN = 12
BOTTOM_INFO_BAR_HEIGHT_MIN = 20
TOP_INFO_BAR_HEIGHT_MIN = 150
FPS_TEXT_ROW = 2
TIMER_TEXT_ROW = 1
INFERENCE_LABEL_TEXT_ROW = 1
PAUSE_TEXT_ROW = 1
LOADING_TEXT_ROW = 1
DONE_C... | StarcoderdataPython |
3304320 | <filename>release/scripts/presets/tracking_camera/Samsung_Galaxy_S4.py
import bpy
camera = bpy.context.edit_movieclip.tracking.camera
camera.sensor_width = 4.8
camera.units = 'MILLIMETERS'
camera.focal_length = 4.2
camera.pixel_aspect = 1
camera.k1 = 0.0
camera.k2 = 0.0
camera.k3 = 0.0
| StarcoderdataPython |
9767815 | <reponame>amitkakde007/To-Do-App_React<filename>Backend/api/views.py
# Django Imports
from django.shortcuts import render
from rest_framework.response import Response
from rest_framework import viewsets
from django.shortcuts import get_object_or_404
from rest_framework import status
# Local Imports
from api.models im... | StarcoderdataPython |
12820190 | from django.conf import settings
from django.contrib.auth.models import User
from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models, transaction
from guardian.shortcuts import assign_perm
from model_utils.models import TimeStampedModel
class Currency(TimeStampedModel):
... | StarcoderdataPython |
318750 | <reponame>itgocode/qxf2-lambdas<filename>raspberry_notifier/credentials.py
import os
USERNAME = os.environ['USERNAME']
PASSWORD = <PASSWORD>['PASSWORD']
PROXY_USERNAME = os.environ['PROXY_USERNAME']
PROXY_PASSWORD = os.environ['PROXY_PASSWORD']
DEVELOPER_KEY = os.environ['DEVELOPER_KEY'] | StarcoderdataPython |
8061709 | <gh_stars>1-10
import numpy as np
def white_noise(t):
"""White noise generated by sampling at random from a uniform distribution.
"""
N = len(t)
x = np.random.uniform(-1.0, 1.0, N)
return x
def brownian_noise(t):
"""Brown noise generated """
N = len(t)
dx = np.zeros(N)
for n in ... | StarcoderdataPython |
6673592 | # bot.py
import discord
import json
import datetime
from threading import Timer
tokenReader = open("token.txt", "r")
token = tokenReader.read()
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
# client.loop.create_task(checkTime())
... | StarcoderdataPython |
9733194 | <reponame>astro-friedel/yggdrasil
import os
import copy
import shutil
import tempfile
import numpy as np
import unittest
from yggdrasil.metaschema.datatypes.tests import (
test_JSONObjectMetaschemaType as parent)
from yggdrasil.metaschema.datatypes import PlyMetaschemaType
from yggdrasil.tests import YggTestClassIn... | StarcoderdataPython |
4820363 | <gh_stars>0
from fornax.utils.generics.factory import GenericFactory
from fornax.consts import Environment
from .executor import Executor
from .bash_shell import BashShellExecutor
from .docker import DockerExecutor
class ExecutorFactory(GenericFactory[Environment, Executor]):
def __init__(self) -> None:
"... | StarcoderdataPython |
11250407 | <reponame>youqingkui/zhihufav<filename>add_queue.py<gh_stars>0
#!/usr/bin/env python
#coding=utf-8
from lib.get_fav_list import CheckList
from lib.db_conn import FavList, session
import random
if __name__ == '__main__':
fav_list = session.query(FavList).all()
for fav in fav_list:
print(fav.api_url)
... | StarcoderdataPython |
22819 | <reponame>thanhnhan311201/via-line-detection<filename>src/util.py
import torch.nn as nn
import cv2
import torch
from copy import deepcopy
import numpy as np
from torch.autograd import Variable
from torch.autograd import Function as F
from numpy.polynomial import Polynomial as P
try:
from parameters import Parame... | StarcoderdataPython |
4956020 | import torch
import torch.nn as nn
class Locate_Entity(nn.Module):
"""
输入 sentence,预测 entity的首尾位置
"""
def __init__(self,
hidden_dim=256,
device='cpu'):
super(Locate_Entity, self).__init__()
self.predict_B = nn.Sequential(
nn.Linear(hidden... | StarcoderdataPython |
9767789 | <gh_stars>0
from utils import *
def task1_1(inputpath, groundTruthPath, dataset, ret=False):
window_size = np.array([50]) # np.array([10, 20, 30, 40, 50])
look_area = np.array([2, 4]) # np.array([10, 20, 30, 40, 50])
step = 10
images = read_of_images(inputpath)
groundtruth = readOF(groundTruthPa... | StarcoderdataPython |
9721665 | import sys
import math
sys.path.append("../airconicsv021")
import primitives, airconics_setup
import rhinoscriptsyntax as rs
class CurveSplit:
def __init__(self,_leadingEdgeCurve,_trailingEdgeCurve,_numberOfDivisions):
self.leadingEdgeCurve = _leadingEdgeCurve
self.trailingEdgeCurve = _trailingEdg... | StarcoderdataPython |
4841132 | import os
import sys
import typing
from subprocess import Popen, PIPE
class Config:
_instance = None
_first_run: bool = False
def __new__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super().__new__(cls)
cls._first_run = True
else:
c... | StarcoderdataPython |
6528869 | # -*- coding: utf-8 -*-
# Copyright 2017-2019 ControlScan, Inc.
#
# This file is part of Cyphon Engine.
#
# Cyphon Engine is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Cyphon En... | StarcoderdataPython |
5158144 | import pandas as pd
import requests
import json
import csv
import os
def get_census_data_from_api(base_url, fips_df, op_file):
count = 0
with open(
f'/Users/salma/Studies/Research/Criminal_Justice/research_projects/main_census_merge/data/census_cities_1990/{op_file}.csv',
'w') as file... | StarcoderdataPython |
203660 | <gh_stars>0
from libpythonpro_github.spam.enviador_de_email import Enviador
from libpythonpro_github.spam.main import EnviadorDeSpam
def test_envio_de_spam(sessao):
enviador_de_spam = EnviadorDeSpam(sessao, Enviador())
enviador_de_spam.envia_emails('<EMAIL>', 'Curso Python Pro', 'Testando essa parte do codigo... | StarcoderdataPython |
1710856 | <gh_stars>0
# -*- coding: utf-8 -*-
from datetime import datetime
from functools import wraps
FORMAT_EXT = {
"GPKG": '.gpkg',
"KML": '.kml',
"GeoJSON": '.json',
"GML": '.gml',
"GPX": '.gpx',
"GPSTrackMaker": ".gmt",
"ESRI Shapefile": ".shp"
}
class FormatException(Exception):
pass
d... | StarcoderdataPython |
3590772 | <filename>homework/1.py
# -*- coding: utf-8 -*-
# 抽样函数及其傅里叶变换
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import mpl_toolkits.axisartist as axisartist
font = {'family':'SimHei'}
matplotlib.rc('font',**font)
matplotlib.rcParams['axes.unicode_minus']=False
fig = plt.figure()
... | StarcoderdataPython |
120935 | import tensorflow
from PIL import Image
import numpy
import argparse
import os
import sys
import pandas
from ModelsEnum import Models
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')))
def predict(model, imgPath, imgHeight, imgWidth):
# 如果 imgPath 是数组
if isinstance(imgPat... | StarcoderdataPython |
9772319 | <reponame>slmjy/oci-ansible-modules
#!/usr/bin/python
# Copyright (c) 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache Licen... | StarcoderdataPython |
224502 | # bidi multimap
from collections import defaultdict
class MMap:
"multimap"
def __init__(self):
self._m = defaultdict(set)
self._pair_cnt = 0
def __contains__(self, k):
"if a key in mmap"
return k in self._m
def __getitem__(self, k):
if k not... | StarcoderdataPython |
5036954 | <gh_stars>10-100
import numpy as np
import json
from load_data import make_freq_dict
from bayesian_blocks import bayesian_blocks
def find_lamhdas(x,bins):
'''
Parameters:
-----------
=> x = train array
=> bins = bins estimated by using bayesian blocks on train data
Functio... | StarcoderdataPython |
257869 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os
import random
SEED=212
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser(
description='Determine which IDs have not been used. Issue a requested number of IDs.\
IDs are assumed to be 5 digit numbers... | StarcoderdataPython |
6463936 | from CodeWriter import CodeWriter
from Parser import Parser
from Lex import Lex, ARITHMETIC_COMMANDS, PUSH_OR_POP_COMMANDS
import os, sys
# Parsing and sanytizing args
asm_file = sys.argv[1]
if asm_file == None:
raise Exception('missing .asm file')
file_name, file_type = os.path.splitext(asm_file)
if file_type.lo... | StarcoderdataPython |
3292588 | <filename>exercicios/aula12-ex044.py
print('{:=^40}'.format('FORMAS DE PAGAMENTO'))
preco = float(input('Digite o valor das compras: '))
print('''ESCOLHA SUA OPÇÃO DE PAGAMENTO
[ 1 ] Dinheiro 10% DESCONTO
[ 2 ] Débito 5% DESCONTO
[ 3 ] Cartão 2x SEM DESCONTO
[ 4 ] Cartão 3x acima 20% JUROS''')
opcao = int(input('Digite... | StarcoderdataPython |
44947 | """
Generate download locations within a country and download them.
Written by <NAME>.
5/2020
"""
import os
import configparser
import math
import pandas as pd
import numpy as np
import random
import geopandas as gpd
from shapely.geometry import Point
import requests
import matplotlib.pyplot as plt
from PIL import Ima... | StarcoderdataPython |
4943756 | from django.core.exceptions import ValidationError
import os
THIS_FOLDER = os.path.dirname(os.path.abspath(__file__))
my_file = os.path.join(THIS_FOLDER,"passwords.txt")
class CommonPasswordValidator:
def validate(self,password,user=None):
with open(my_file,"r") as f:
for line in f:
... | StarcoderdataPython |
1679263 | <reponame>cgoIT/lexicon<filename>lexicon/tests/providers/test_ultradns.py<gh_stars>0
"""Integration tests for UltraDNS"""
from unittest import TestCase
from lexicon.tests.providers.integration_tests import IntegrationTests
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *eac... | StarcoderdataPython |
6689101 | <reponame>zscole/rchain
def test_data_is_stored_and_served_by_node(command_line_options, docker_client):
assert True
| StarcoderdataPython |
8114026 | <filename>main.py
#!/usr/bin/env python3
try:
from cvelookup.db.dblookup import Database
from colored import fg, attr
import subprocess
import sys
import os
if os.name != 'nt':
import readline
except ImportError as err:
print(err)
VALID_OPERATORS = (">", "<", "=" , ">=... | StarcoderdataPython |
294102 | a = 25
b = 0o31
c = 0x19
print(a)
print(b)
print(c)
| StarcoderdataPython |
3531453 | import os.path
import sys
import math
import argparse
import time
import random
import numpy as np
from collections import OrderedDict
import logging
from PIL import Image
import torch
import torchvision
from torchvision import transforms
import options.options as option
from utils import util
from data import create_d... | StarcoderdataPython |
11284659 | import time
import questionary
import serial_ports
import edit_list
import config
import twitchapi
import serial
import time
def menu():
menu = questionary.select('What do you want to do?',
choices=['Start', 'Show the streamers list',
... | StarcoderdataPython |
1791924 | def register_routes(api, app, root="app"):
from app.api.model import register_routes as attach_model
from app.api.meta import register_routes as attach_meta
from app.api.pipelines import register_routes as attach_pipelines
from app.api.composer import register_routes as attach_composer
from app.api.... | StarcoderdataPython |
3519342 | <gh_stars>1-10
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or ... | StarcoderdataPython |
6645782 | from base_sub_rig_template import SubRigTemplate
class QuadrupedArm(SubRigTemplate):
BUILT_IN_META_DATA = SubRigTemplate.BUILT_IN_META_DATA.merge({'name': 'quadarm'}, new=True)
| StarcoderdataPython |
4803608 | import json
if __name__ == "__main__":
fp = open("result.json", "r")
wp = open("textrank_output.txt", "w")
for line in fp:
wd = json.loads(line.strip())
wp.write("{0}:{1}\n".format(wd["text"], wd["rank"]))
fp.close()
wp.close()
| StarcoderdataPython |
6509548 | def get_urls(*args, **kwargs):
return {
'https://raw.githubusercontent.com/rtfd/sphinx_rtd_theme/master/README.rst'
}, set()
| StarcoderdataPython |
11204633 | import tensorflow as tf
import numpy as np
class Selector(object):
def __init__(self, num_classes, is_training = False, drop_prob = None):
self.num_classes = num_classes
self.is_training = is_training
self.dropout = drop_prob
def __call__(self, is_training = False, drop_prob = None):
... | StarcoderdataPython |
11368177 | <filename>src/cool/cmp/.ipynb_checkpoints/tools-checkpoint.py
import zlib, base64
exec(zlib.decompress(base64.b64decode('<KEY>)))
# Created by pyminifier (https://github.com/liftoff/pyminifier)
deprecated_metodo_predictivo_no_recursivo = metodo_predictivo_no_recursivo
def metodo_predictivo_no_recursivo(G, M):
pars... | StarcoderdataPython |
3372428 | """
A service that will process requests from the public web
and will have access the CA certificates.
"""
| StarcoderdataPython |
3443817 | # This is test file for typing,
# No automatic testing is used at the moment. Just use your type checker and see if it works.
# Pytest here is used to make sure that runtime behavir matches with type checker expecter errors.
from typing import Any, Callable
import pytest
from decopatch import DECORATED, function_deco... | StarcoderdataPython |
12815692 | <reponame>MartienJun/flask-Travelnesia
from flask import Blueprint, render_template, request, redirect, url_for
from flask.helpers import flash
from flask_login import current_user, login_required
from app.Models.transportation import Transportation
from app.Controllers.transportation_controller import TransportationCo... | StarcoderdataPython |
1820319 | <reponame>Qointum/pypy
import py, weakref
from rpython.jit.backend import model
from rpython.jit.backend.llgraph import support
from rpython.jit.backend.llsupport import symbolic
from rpython.jit.metainterp.history import AbstractDescr
from rpython.jit.metainterp.history import Const, getkind
from rpython.jit.metainter... | StarcoderdataPython |
3316573 | <reponame>JLTastet/scalar_portal<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from nose.tools import assert_equals, assert_raises
from ..data import constants as c
def test_ckm():
assert_equals(c.ckm(1,1), c.Vud)
assert_equals(c.ckm(1,2), c.Vus)
assert_equals(c.ckm(1,3), ... | StarcoderdataPython |
8057050 | from sqlobject import *
sqlhub.processConnection = connectionForURI('sqlite:mydatabase.db')
class User(SQLObject):
class sqlmeta:
table = 'users'
name = StringCol()
fullname = StringCol()
password = StringCol()
if __name__ == "__main__":
User.dropTable(ifExists=True)
User.createTab... | StarcoderdataPython |
11244133 | <reponame>DeepRank/DeepRank_VariantPred<gh_stars>0
import os
from tempfile import mkdtemp, mkstemp
from shutil import rmtree
import h5py
import numpy
import torch.optim as optim
from nose.tools import ok_
from deeprank.models.variant import PdbVariantSelection
from deeprank.generate.DataGenerator import DataGenerator... | StarcoderdataPython |
3244555 | <reponame>jurayev/data-structures-algorithms-solutions<gh_stars>0
class File:
def __init__(self, name, content):
self.name = name
self.content = [content]
self.is_file = True
class Dir:
def __init__(self):
self.subdirs = defaultdict(Dir)
self.is_file = False
cl... | StarcoderdataPython |
1921674 |
class AccessError(RuntimeError):
pass | StarcoderdataPython |
8151206 | <gh_stars>1-10
import datetime
import pytest
from django.urls import reverse
from django.utils import timezone
from oauth2_provider.models import AccessToken, Application
from rest_framework import status
from rest_framework.test import APIClient
from sso.user.models import User, UserProfile
def setup_data():
s... | StarcoderdataPython |
1247 | # -*- coding: utf-8 -*-
'''
Tests for the file state
'''
# Import python libs
from __future__ import absolute_import
import errno
import os
import textwrap
import tempfile
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.paths import TMP_STATE_TREE
from tests.support.mixins impor... | StarcoderdataPython |
11204758 | <filename>linformer/__init__.py
from linformer.linformer import LinformerLM, Linformer, LinformerSelfAttention
| StarcoderdataPython |
11399525 | <filename>tests/framework/project/test_pipeline_registry.py
import sys
import textwrap
import pytest
from kedro.framework.project import configure_project, pipelines
from kedro.pipeline import Pipeline
@pytest.fixture
def mock_package_name_with_pipelines_file(tmpdir):
pipelines_file_path = tmpdir.mkdir("test_pa... | StarcoderdataPython |
3492180 | <filename>unmix/test/mask/mask.py
import numpy as np
import os
import time
import argparse
import librosa
from unmix.source.data.song import Song
from unmix.source.configuration import Configuration
from unmix.source.engine import Engine
from unmix.source.logging.logger import Logger
from unmix.source.data.dataloader ... | StarcoderdataPython |
6547561 | import tkinter
window = tkinter.Tk()
# The model.
counter = tkinter.IntVar()
counter.set(0)
#One controller with parameters.
def click(variable, value):
variable.set(variable.get()+value)
# Two controllers
def click_up():
click(counter, 1)
def click_down():
click(counter, -1)
# The views.
frame = tkint... | StarcoderdataPython |
1676196 | <reponame>wh629/CNLI-generalization
import os
import time
import torch
import traceback
from contextlib import contextmanager
import jiant.utils.python.io as py_io
import jiant.utils.python.filesystem as filesystem
class BaseZLogger:
def log_context(self):
raise NotImplementedError()
def write_entr... | StarcoderdataPython |
6644253 | <reponame>JoseALermaIII/python-tutorials
#! python3
"""Rename dates
Renames filenames with American MM-DD-YYYY date format to European DD-MM-YYYY date format.
Uses :py:mod:`os` to get the list of files, :py:mod:`re` to find the files with the American
date format, and :py:mod:`shutil` to rename them.
Note:
* As... | StarcoderdataPython |
4865034 | <reponame>twilio-labs/gordon<filename>gordon/configurations/pagerduty_config.py
from gordon.services.common.secrets_loader import get_secrets
import os
# Configuration to load Pagerduty relevant data used at runtime
class PagerDutyConfig:
def get_pagerduty_url(self):
pd_url = os.environ.get("PAGERDUTY_URL... | StarcoderdataPython |
9730984 | <filename>RealisticWeatherAPI/services/report_service.py
import datetime
import uuid
from typing import List
from models.location import Location
from models.report import Report
__reports: List[Report] = []
async def get_reports() -> List[Report]:
return list(__reports)
async def add_report(description: str, lo... | StarcoderdataPython |
5054772 | <reponame>nftlabs/nftlabs-sdk-python<gh_stars>10-100
from typing import List, Generic
from thirdweb.common.error import NotFoundException
from thirdweb.common.nft import fetch_token_metadata
from thirdweb.constants.currency import ZERO_ADDRESS
from thirdweb.constants.role import Role, get_role_hash
from thirdweb.core.c... | StarcoderdataPython |
8114833 | <reponame>yuyichao/rr<filename>src/test/restart_unstable.py
from rrutil import *
send_gdb('c')
expect_gdb('exited normally')
restart_replay()
expect_gdb('exited normally')
ok()
| StarcoderdataPython |
4919796 | # sql/functions.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from .. import types as sqltypes, schema
from .expression import (
ClauseList, Fu... | StarcoderdataPython |
4817378 | <gh_stars>0
#!/usr/bin/python3
"""
Sensors aggregation and storage.
https://github.com/dimitar-kunchev/NR-VentilationMonitoring
@author: <NAME>
@license: See the LICENSE file
@email: <EMAIL>
"""
import RPi.GPIO as GPIO
import serial
import time
import pymysql
import configparser
import json
import os
import sys
import ... | StarcoderdataPython |
5184291 | import csv
import xlrd
from rich import print
from Iciba import Iciba
from concurrent.futures import ThreadPoolExecutor
# debug
import time
# 你Diy的单词本
InFilename = 'data.xls'
# 输出文本
OutFilename = 'eggs1.csv'
# 初始化Iciba模块
Dictionary = Iciba()
# Iciba 查词错误码
ErrIciba = -1
query_res = {}
def word(query):
# eg:
... | StarcoderdataPython |
6598481 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget, QToolTip, QPushButton, QComboBox, QMessageBox, QDesktopWidget, QProgressBar, QLabel, QHBoxLayout, QVBoxLayout, QSizePolicy, QMenu, QAction
from PyQt5.QtGui import QIcon, QPalette, QBrush, QImage, QPixmap, QFont, QC... | StarcoderdataPython |
9713198 | """
Static RMQ
"""
N, Q = [int(x) for x in input().split()]
AS = [int(x) for x in input().split()]
INF = 10 ** 10
SEG_TREE_WIDTH = 1 << N.bit_length()
seg = [INF] * (SEG_TREE_WIDTH * 2) # 0-origin
def range_min_query(start, end, node=1, nstart=0, nend=SEG_TREE_WIDTH):
# print("node", node, (nstart, nend))
i... | StarcoderdataPython |
4875706 | <gh_stars>1-10
from zmq import devices
import collections
import time
import operator
import memcache
def cluster(spec):
address, key = spec.split('/')
return memcache.Client([address]).get(key).split(',')
def elect(client, name, candidate, ttl=60):
""" Simple leader election-esque distributed selection m... | StarcoderdataPython |
266297 | """Create new objects of various types. Deprecated.
This module is no longer required except for backward compatibility.
Objects of most types can now be created by calling the type object.
"""
from warnings import warnpy3k
warnpy3k("The 'new' module has been removed in Python 3.0; use the 'types' "
... | StarcoderdataPython |
1680545 | # -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 <NAME>, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your op... | StarcoderdataPython |
1667738 | #!/usr/bin/env python
import requests
import subprocess
import sys
import os
import lxml.html as lh
import logging
logging.basicConfig(filename='pyget.log', filemode='w', \
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', \
level=logging.DEBUG)
def main(url, dir_dest):
print("## Start ##"... | StarcoderdataPython |
6669522 | from django.shortcuts import redirect, HttpResponse
from django.views.generic.base import TemplateView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from processing.base.decorators import group_required
from processing.base.managers import MessageManage... | StarcoderdataPython |
4851066 | <reponame>charliecalvert/CloudNotes
#! /usr/bin/python3
import shutil
def step01():
for x in range(1, 10):
source = 'Isit322-Week0' + str(x) + '-2015.md'
destination = 'Isit322-Week0' + str(x) + '-2016.md'
shutil.copyfile(source, destination);
def step02():
for x in range(0, 2):
source = 'Isit322-Week1' ... | StarcoderdataPython |
11381139 | <gh_stars>1-10
#! /usr/bin/env python
####################################################################################################
# SET UP
#
#
# TODO: Probabilistic Guess Function
# TODO: Account for likelihood that ships are not adjacent
# TODO: Minimize Entropy Model
import socket
import time
import util
f... | StarcoderdataPython |
3439454 |
import unittest
from import_new_tournaments.process_hh_files.process.tournament.extract.price import price
class test(unittest.TestCase):
def test_price(self):
filename = "HH20201217 SITGOID-G23140238T1 TN-$0{FULLSTOP}50 Hold'Em Turbo - On Demand GAMETYPE-Hold'em LIMIT-no CUR-REAL OND-T BUYIN-0.txt"
... | StarcoderdataPython |
3452640 | <filename>proj_issues/issues/views.py
# Imports {{{
from __future__ import print_function, unicode_literals, division
from pprint import pprint
from difflib import Differ
from django.http import HttpResponse
from django.core.urlresolvers import reverse, reverse_lazy
from django.contrib.admin.views.decorators import st... | StarcoderdataPython |
3454731 | import argparse
import io
import os
import math
import uuid
import tensorflow as tf
import hypergan as hg
import hyperchamber as hc
import json
from hypergan.generators import *
from hypergan.search.random_search import RandomSearch
from hypergan.viewer import GlobalViewer
from common import *
from PIL import Image
im... | StarcoderdataPython |
1704657 | # -*- coding: utf-8 -*-
# Copyright (c) 2022 by <NAME>
import os
import sys
import glob
import torch
import random
import timeit
import configs
import logging
import numpy as np
import pandas as pd
import transformers
from tqdm import tqdm, trange
from adapt_mrc_model import AdaptMRCModel
from data_generator import QA... | StarcoderdataPython |
12836513 | # Metrics dataset that comprises of vectors which will be searched for in job postings.
pl = [
['python', False],
['c#', False],
['c', False],
['c++', False],
['ruby', False],
['java', False],
[['javascript', 'js'], False],
[['html', 'html5'], False],
['css', False],
['sql', Fal... | StarcoderdataPython |
5032126 | <reponame>CodingForVega/silverstrike
from datetime import date
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse, reverse_lazy
from django.views import generic
from silverstrike.forms im... | StarcoderdataPython |
8194895 | <reponame>panc-test/python-study
"""
退出程序:
exit()
quit()
"""
# for i in range(10):
#
# if i == 5:
# # print(quit())
# # quit()
# print(exit())
# exit()
#
# print(i)
print(type(range(10))) | StarcoderdataPython |
1684394 | """Constant learning rate."""
from optimus.types import LRMethod
class Constant(LRMethod):
"""Used when a single learning rate will be used for all steps."""
def __init__(self, learning_rate: float):
self.learning_rate = learning_rate
def __call__(self, *args, **kwargs):
return self.lear... | StarcoderdataPython |
3285346 | # (c) 2017 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | StarcoderdataPython |
4879087 | # Copyright (c) 2019, NVIDIA Corporation. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, visit
# https://nvlabs.github.io/stylegan2/license.html
import argparse
import numpy as np
import PIL.Image
import dnnlib
import dnnlib.tflib as tfli... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.