id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1602579
# Given a 'wrong' binary tree, how to find a node that has two edge?
StarcoderdataPython
3328909
<reponame>ttungbmt/BecaGIS_GeoPortal # -*- coding: utf-8 -*- # Generated by Django 1.11.15 on 2018-10-15 00:01 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='GeoNodeT...
StarcoderdataPython
3230245
<filename>src/tests/ftest/util/check_for_pool.py #!/usr/bin/python ''' (C) Copyright 2017-2019 Intel Corporation. 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/...
StarcoderdataPython
61851
<reponame>IdeaBot/basics from libs import reaction class Reaction(reaction.AdminReactionAddCommand): '''Sets emojis to commands in servers This works alongside `set_emoji` **Usage** React with an emoji to the message sent in response to `emoji_starter` to use that emoji To learn how to use `emoji_starter` ```@Id...
StarcoderdataPython
145122
<gh_stars>0 "jq_eval rule" load("@bazel_skylib//lib:collections.bzl", "collections") load("@bazel_skylib//lib:shell.bzl", "shell") _DOC = "Defines a jq eval execution." _ATTRS = { "srcs": attr.label_list( doc = "Files to apply filter to.", allow_files = True, ), "filter": attr.string( ...
StarcoderdataPython
1631747
""" Copyright (c) Microsoft Corporation. Licensed under the MIT license. HERO for pretraining copied/modified from HERO (https://github.com/linjieli222/HERO) """ from collections import defaultdict import random import torch from torch import nn from torch.nn import functional as F import horovod.torch as hvd from ...
StarcoderdataPython
3295395
<filename>heaps/max_heap.py<gh_stars>0 class MaxHeap: def __init__(self, heap, heap_size=None): self.heap = heap self.heap_size = heap_size if heap_size else len(heap) self.build() def left(self, i): left_index = 2 * i if left_index > self.heap_size: return N...
StarcoderdataPython
1754076
<reponame>unseenme/mindspore # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
StarcoderdataPython
1642076
<filename>djangoapps/teachers/admin.py from __future__ import unicode_literals from django.contrib import admin from djangoapps.teachers.models import Teacher, Experience, Education, Certificate, Immersion, Price, \ PrivatePriceDetail, GroupPriceDetail, Rating # INLINE BLOCKS class EducationInline(admin.StackedI...
StarcoderdataPython
1672896
<filename>wfpm/__init__.py # -*- coding: utf-8 -*- """ Copyright (c) 2021, Ontario Institute for Cancer Research (OICR). 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 htt...
StarcoderdataPython
3365388
<filename>main.py from flask import Flask, Response, request, redirect from int2base import int2base import json app = Flask(__name__) url_map = [] map_len = 0 def make_slug(): global map_len map_len += 1 return int2base(map_len, 36) def find_item_by(type, value): results = [i for i, v in enumerate...
StarcoderdataPython
3356579
filenames = ['/data/params/d/SubaruCars'] with open('/data/params/d/Cars', 'w') as outfile: for names in filenames: with open(names) as infile: outfile.write(infile.read()) outfile.write("\n")
StarcoderdataPython
42139
<filename>cryptofield/algorithms/berlekamp.py from cryptofield.fieldpolynom import * from cryptofield.algorithms.field_algorithms import * def Berlekamp(F, polynom): f = polynom.copy() factors = list() if f.deg() <= 1: factors.append(f) return factors if not f.c[-1] == FElement(F, 1): factors.app...
StarcoderdataPython
1794710
import json import os from newssimilarity.definitions import slash, saved_models_path """ Use to save learned models """ """def save(model, name): path = slash.join(saved_models_path + [name]) #p = slash.join(saved_models_path) #print(os.listdir(p)) model_json = model.to_json() with open(path +...
StarcoderdataPython
186402
<filename>financePy/general_tools.py import time import requests import datetime as dt import pandas as pd import numpy as np import quandl import os import re import zipfile import pandas as pd import json import re as __re__ from selenium import webdriver from selenium.webdriver.firefox.options import Options from b...
StarcoderdataPython
1689217
<filename>examples/tilechain_invaders.py from lifxlan import * from random import randint from time import sleep def main(): lan = LifxLAN() tilechain_lights = lan.get_tilechain_lights() if len(tilechain_lights) != 0: t = lan.get_tilechain_lights()[0] # grab the first tilechain print("Sel...
StarcoderdataPython
3268309
""" Django settings for ws project. Generated by 'django-admin startproject' using Django 1.8.7. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths ins...
StarcoderdataPython
81724
from test.integration.base import DBTIntegrationTest, use_profile class TestBaseBigQueryResults(DBTIntegrationTest): @property def schema(self): return "bigquery_test_022" @property def models(self): return "models" @property def project_config(self): return { ...
StarcoderdataPython
3227729
""" knox ~~~~ Implements a monte carlo algorithm to compute knox statistics and p-values. 1. <NAME>, "The Burglary as Clue to the Future: The Beginnings of Prospective Hot-Spotting", European Journal of Criminology Volume: 1 issue: 2, page(s): 237-255. DOI: https://doi.org/10.1177/1477370804041252 2. <NAME>., <...
StarcoderdataPython
16869
#!/usr/bin/python # -*- coding: utf-8 -*- import logging from datetime import datetime from scholarly_citation_finder import config from scholarly_citation_finder.apps.parser.Parser import Parser from scholarly_citation_finder.apps.core.models import PublicationUrl from scholarly_citation_finder.tools.extractor.grobid...
StarcoderdataPython
115106
''' Authors: <NAME>, <NAME> ''' # FIXME Behebe möglichen fehler mit Flask: # https://github.com/flask-restful/flask-restful/pull/913 # import flask.scaffold # flask.helpers._endpoint_from_view_func = flask.scaffold._endpoint_from_view_func from hashlib import sha1 from flask import Flask, request as req from flask_res...
StarcoderdataPython
170560
<reponame>Samyak-jain09/QnA<gh_stars>0 from django.views.generic import DetailView, TemplateView,ListView from django.views.generic.edit import CreateView from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render from django.contrib import messages from django.shortcuts import...
StarcoderdataPython
196232
<reponame>marcosboggia/gui_automation<filename>gui_automation/gui_automation.py # Made by <NAME> from gui_automation.foreground_handler import ForegroundHandler from gui_automation.image_detector import TMDetector import functools def _values_from_fraction(fraction): """ Used to obtain the numbers from fra...
StarcoderdataPython
3265402
# -*- coding: utf-8 -*- # 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 copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Lic...
StarcoderdataPython
1697946
<gh_stars>0 import torch import torch.nn as nn import torch.functional as F import matplotlib.pyplot as plt class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() # self.nn = nn self.conv1 = nn.Sequential( nn.Conv2d(in_channels=3, out_channels=256, ...
StarcoderdataPython
1716441
import pandas as pd def generateOtherRandomNumbers(N_applicant, rdm_numbers): list_N_applicant = list(range(N_applicant)) for i in rdm_numbers: list_N_applicant.remove(i) return list_N_applicant def generateLotteryDataFrame(df, rdm_numbers): """ Generate the lottery list of Dat...
StarcoderdataPython
3329567
# Copyright 2017 Rice University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
StarcoderdataPython
49960
import pygame from pygame.locals import * import time from assets import * from terrain import * from player import * from pnj import * from carte import * class intro(): time = 0 end = 670 def intro(): intro.time += 1 # arrivé dans le monde s1 = 35 #vue du hl s2 = ...
StarcoderdataPython
106882
<filename>chals/web/docs/app/__init__.py<gh_stars>10-100 #linux x64 #python 2.7 dependencies: #certifi==2019.6.16 #chardet==3.0.4 #Click==7.0 #Flask==1.1.1 #gunicorn==19.9.0 #idna==2.8 #itsdangerous==1.1.0 #Jinja2==2.10.1 #MarkupSafe==1.1.1 #requests==2.22.0 #urllib3==1.25.3 #uuid==1.30 #Werkzeug==0.15.5 #setuptools==4...
StarcoderdataPython
118689
<reponame>laddge/reclip<gh_stars>1-10 from .server import serve from .client import set, get, delete __version__ = '1.0.2'
StarcoderdataPython
1771944
<reponame>kitegi/mpfr-cxx import subprocess, os read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True' if read_the_docs_build: subprocess.call( 'mkdir -p build && cd build && ' 'cmake -DMPFR_CXX_BUILD_DOCS=ON ../.. && ' 'make doxygen-docs', shell=True) xmldir = 'bui...
StarcoderdataPython
89450
import xml.etree.ElementTree as ET from freeswitch import * """ Freeswitch Azure bot Application This script interacts with Azure echo bot API via UniMRCP server. * Revision: 1 * Date: May 7, 2021 * Vendor: Universal Speech Solutions LLC """ class AzureBotApp: """A class representing ...
StarcoderdataPython
1750731
import numpy as np import math def l2_regularization(W, reg_strength): ''' Computes L2 regularization loss on weights and its gradient Arguments: W, np array - weights reg_strength - float value Returns: loss, single value - l2 regularization loss gradient, np.array same shape...
StarcoderdataPython
194579
import sys from typing import Dict from decouple import Module from ..constants import AnsiColor as Color, ConsoleMode, LoaderName from ..epoch import EpochStartEvent from ..events import RunnerForceStopEvent from ..loader import LoaderStartEvent, LoaderProcessBatchEndEvent from ..metric.metric_manager import MetricM...
StarcoderdataPython
3247586
<gh_stars>1-10 # # A VCR index. # import os import string error='VcrIndex.error' VERSION_STRING='#!VcrIndex 1.1\n' PREV_VERSION_STRING='#!VcrIndex 1.0\n' class VcrIndex: def __init__(self, name): self.curmovie = None self.curscene = None self.modified = 0 self.filename = name self.basename = os.path.basena...
StarcoderdataPython
135288
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Train normalising flow. Created: June 2021 Author: <NAME> """ import numpy as np import sys sys.path.append("../../src") from constants import kpc from ml import train_flow from utils import get_rescaled_tensor if __name__ == '__main__': # load data data =...
StarcoderdataPython
118348
import sys import json import syscalls import os from cfg import cached_results_folder def filter_file(fname): f = fname.replace("/", "_") + ".json" if f[0] == ".": f = f[1:] return f def main(fname): used_syscalls = [] ffname = os.path.join(cached_results_folder, "syscalls_%s" % filter_fi...
StarcoderdataPython
1742977
# functiom def myfunction(): print('Inside myfunction') myfunction()
StarcoderdataPython
3298160
<gh_stars>1000+ from typing import Any from fastapi import FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel class PersonBase(BaseModel): name: str lastname: str class Person(PersonBase): @property def full_name(self) -> str: return f"{self.name} {self.lastnam...
StarcoderdataPython
3243546
<reponame>dkuspawono/cloudmarker """Test package.""" import os data_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
StarcoderdataPython
159165
<reponame>srini009/ascent ############################################################################### # Copyright (c) Lawrence Livermore National Security, LLC and other Ascent # Project developers. See top-level LICENSE AND COPYRIGHT files for dates and # other details. No copyright assignment is required to contr...
StarcoderdataPython
3360462
<reponame>JungHoonJung/2021MD<gh_stars>100-1000 #!/usr/bin/env python3 # qmc_walk_sho.py #------------------------------------------------------------------------------------------------# # This software was written in 2016/17 # # by <NAME> <<EMAIL>>/<<EMAIL>> ...
StarcoderdataPython
3210115
<filename>offpage/abstractapi_preview/main.py<gh_stars>0 import requests params = {"capture_full_page": "False", "width": 1920, "height": 1080} url = "https://heapoftech.live" response = requests.get( f"https://screenshot.abstractapi.com/v1/?api_key=ba5121e7767b40cfa23a1c8d5f7d81c7&url={url}", params=params, ...
StarcoderdataPython
1721105
""" @package mi.dataset.driver.dofst_k.wfp.driver @file marine-integrations/mi/dataset/driver/dofst_k/wfp/driver.py @author <NAME> @brief Driver for the dofst_k_wfp Release notes: initial release """ __author__ = '<NAME>' __license__ = 'Apache 2.0' import os import string import gevent from mi.core.common import Ba...
StarcoderdataPython
4836490
#!/usr/bin/env python #coding:utf-8 # Author: mozman --<<EMAIL>> # Purpose: full11 data # Created: 15.10.2010 # Copyright (C) 2010, <NAME> # License: MIT License from svgwrite.data.types import SVGAttribute, SVGMultiAttribute from svgwrite.data.types import SVGElement from svgwrite.data.typechecker import F...
StarcoderdataPython
90631
from features import lrf_estimator as lrfe from dataloader import dataset_localpcd_benchmark as ds from dataloader import spherical_voxel as sv from models import network_s2_layer as nsl from models import network_lrf_layer as nll from utils import torch as utor from utils import progress_bar import numpy as np fr...
StarcoderdataPython
1702950
import json from os.path import exists import numpy as np from sklearn.linear_model import Ridge from sklearn.metrics import make_scorer from sklearn.model_selection import GridSearchCV, KFold from scipy.stats import rankdata, zscore from scipy.spatial.distance import cdist from gifti_io import read_gifti, write_gifti ...
StarcoderdataPython
1701778
/home/runner/.cache/pip/pool/86/17/cf/46b6fe8077121ab3852a0da9898322e25ade7cb473eebe020fdec09a98
StarcoderdataPython
1771919
from webbot import Browser import time web = Browser() web.go_to('https://www.youtube.com/') web.type('YouThinker' , into='Search' , id='search.ytd-searchbox') web.press(web.Key.ENTER) web.click('YOU THINKER') web.click('CHRISTMAS DAY')
StarcoderdataPython
1777532
<filename>tests/UnitTests.py<gh_stars>1-10 import itertools import multiprocessing import os import random import shutil import unittest import exemcl import numpy as np import pandas from sklearn.datasets import make_blobs DIM = 10 N = 500 def L(V, S): accu = 0 for e in V: accu += min([pow(np.linal...
StarcoderdataPython
1674000
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distr...
StarcoderdataPython
181390
""" File: circulararray.py Author: <NAME> Date: August 21, 2018 Descrioption: This a python implementation of a circular array using a list. This implementation could be used as a queue or an array. Copyright (c) 2018, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without mod...
StarcoderdataPython
1618854
<reponame>mavalentim/mais<filename>.github/workflows/data-check/test_data.py<gh_stars>1-10 # ------------------------------------- # Execute at Test Time # ------------------------------------- # Each test is executed # once for all tables # ------------------------------------- import json import basedosdados as bd ...
StarcoderdataPython
52650
import pytest from django.db import transaction from django.utils import timezone from ..models import Message, FOIRequest, Esic, PublicBody @pytest.fixture def public_body(esic): return PublicBody( name='example', esic=esic ) @pytest.fixture def esic(): return Esic( url='http:/...
StarcoderdataPython
3267647
<filename>test/test_insertion.py from unittest import TestCase from transposcope.insertion import Insertion class TestInsertion(TestCase): def test_calculate_if_insertion_is_complement_true(self): test_insertion = Insertion(None, 1, 8, 6, 8, "-", 1, 1, 8, False) self.assertTrue(test_insertion.ME_...
StarcoderdataPython
3323190
<filename>test/test_systemctl_enable_disable.py # systemctl enable: successful. def test_systemctl_enable(sysvenv): service = sysvenv.create_service("foo") out, err, status = service.invoke("enable") assert status == 0 assert service.is_enabled() assert not service.did("start") # systemctl is-enab...
StarcoderdataPython
1645329
<filename>database/db.py import pymongo from decouple import config mongo = pymongo.MongoClient(config('MONGODB_ATLAS_CONNECTION_STRING_PROD'), connect=False) db = pymongo.database.Database(mongo, config('MONGODB_ATLAS_PROD_NAME')) col = pymongo.collection.Collection(db, config('MONGODB_ATLAS_COLLECTION_NAME'))
StarcoderdataPython
3353926
<reponame>PhilippKuntschik/weblyzard_api from __future__ import unicode_literals from weblyzard_api.model.parsers.xml_2013 import *
StarcoderdataPython
3388398
<reponame>Pretsdaya/pysectprop from math import cos, sin, pi, atan, degrees from matplotlib.pyplot import figure from matplotlib.path import Path from matplotlib.patches import PathPatch, Patch from matplotlib.collections import PatchCollection from matplotlib.pyplot import rcParams from py2md.classes import MDHeading,...
StarcoderdataPython
3238224
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import A4 import math import random import copy import string # 25. Вычислить факториал некоторого числа, используя рекурсию. def factorial(x): """ Input: x: some integer number Output: factorial of input number. """ fact = 1 ...
StarcoderdataPython
127344
""" IDE: PyCharm Project: simulating-doctor-patient-interviews-using-neural-networks Author: Robin Filename: testing.py Date: 16.07.2019 """ import csv import scipy import torch from sklearn.metrics import classification_report from torchtext.data import TabularDataset, BucketIterator, Field from tqdm import tqdm f...
StarcoderdataPython
79292
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .backbone import build_backbone
StarcoderdataPython
3228054
def multi_getattr(obj, attr, default = None): """ Get a named attribute from an object; multi_getattr(x, 'a.b.c.d') is equivalent to x.a.b.c.d. When a default argument is given, it is returned when any attribute in the chain doesn't exist; without it, an exception is raised when a missing attribute ...
StarcoderdataPython
4812207
<reponame>clovaai/textual-kd-slu<filename>preprocessing.py<gh_stars>1-10 ''' Textual KD SLU Copyright (c) 2021-present NAVER Corp. Apache License v2.0 ''' import wave import argparse import json import os parser = argparse.ArgumentParser(description='pre-processing') parser.add_argument('--config', type=str) args = pa...
StarcoderdataPython
12296
<reponame>triump0870/Interactive_Programming_Python # Simple implementation of GalaxyInvanders game # <NAME> (India) - 3 Nov 2013 # www.codeskulptor.org/#user23_fTVPDKIDhRdCfUp VER = "1.0" # "add various aliens" import simplegui, math, random, time #Global const FIELD_WIDTH = 850 FIELD_HEIGHT = 500 TOP...
StarcoderdataPython
30235
from django.db import models class Roles(models.TextChoices): USER = 'user', 'User' MODERATOR = 'moderator', 'Moderator' ADMIN = 'admin', 'Admin'
StarcoderdataPython
3351803
#!/usr/bin/env python3 ''' Copyright 2017 The Regents of the University of Colorado 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 ...
StarcoderdataPython
85643
from abc import ABCMeta, abstractmethod import numpy as np import scipy as sp from sklearn import linear_model import sklearn.metrics.pairwise ############################### ## Random Explainer ############################### class RandomExplainer: def __init__(self): pass def reset(self): pass def e...
StarcoderdataPython
1797358
<gh_stars>1-10 #!/usr/bin/env python # -*- encoding: utf-8 -*- """ Topic: 实战演练 """ import requests import re from io import StringIO import json from requests import Request, Session from contextlib import closing from requests.auth import AuthBase from requests.auth import HTTPBasicAuth from requests.auth import HTTPD...
StarcoderdataPython
1708660
# Quark Runtime # Usage: from quark_runtime import * # This brings in the stuff mentioned in __all__ below. # The wrong way to do this, but minimizes the code change. from __future__ import absolute_import from __future__ import unicode_literals __version__ = '0.4.2' __all__ = str( """os sys time _Map _List _pri...
StarcoderdataPython
3390187
# Generated by Django 2.2.13 on 2020-07-12 22:16 from django.db import migrations import django_ltree.fields class Migration(migrations.Migration): dependencies = [ ('clist', '0044_problemtag'), ] operations = [ migrations.AddField( model_name='contest', name='ti...
StarcoderdataPython
1707802
from PIL import Image, ImageDraw from random import randint import requests import regex class Wakatime: URL = "https://wakatime.com/api/v1/" TIME_TABLE = { "7": "last_7_days", "30": "last_30_days", "180": "last_6_months", "365": "last_year", } def __init__(self, app_...
StarcoderdataPython
4804897
<gh_stars>10-100 # -*- coding: utf-8 -*- from typing import List from maths.nodes import AstNode class BaseStmt: def __init__(self): self.parent = None def __repr__(self): return "BaseStmt()" def python(self) -> List[str]: return [""] def get_children(self) -> List[AstNode...
StarcoderdataPython
126267
print('===== DESAFIO 92 =====') from datetime import datetime pessoa = {} pessoa['nome'] = str(input('Nome: ')) pessoa['idade'] = datetime.now().year - int(input('Ano de Nascimento: ')) pessoa['ctps'] = int(input('Carteira de Trabalho (0 não tem): ')) if pessoa['ctps'] != 0: pessoa['contr'] = int(input('Ano de Cont...
StarcoderdataPython
3306337
<reponame>MinionAttack/WhatDoesItSay # -*- coding: utf-8 -*- GOOGLE_APPLICATION_CREDENTIALS = "" BUCKET_NAME = "" # DOT NOT MODIFY THE BELOW PROPERTIES UNLESS YOU ARE DEVELOPING THE PROGRAM # LOGS_FOLDER = 'logs' # Available loggers: development, production LOGS_MODE = 'production' # Available levels: CRITICAL = 50...
StarcoderdataPython
4810317
"""Entry point for HTCrystalBall examination and collection.""" from . import __version__, collect, examine from .utils import validate_storage_size, validate_duration import argparse import sys def main(): description = ( '%(prog)s - A crystal ball that lets you peek into the future. ' 'To get a...
StarcoderdataPython
1632341
import os import apache_beam as beam import MyParDos import json import time import datetime from apache_beam.io.mongodbio import ReadFromMongoDB, WriteToMongoDB from flask import Flask, flash, request, redirect, url_for, render_template, Response from flask_pymongo import PyMongo from bson import json_util from elasti...
StarcoderdataPython
3356086
<reponame>schrma/oloid<filename>tests/test_geometric_functions.py<gh_stars>0 import pytest import numpy as np import oloid.geometric_functions def test_get_orthogonal_raise(): with pytest.raises(TypeError): oloid.geometric_functions.get_orthogonal_vector([0,1,2]) @pytest.mark.parametrize("input_vector", ...
StarcoderdataPython
1727901
import os import sys import prody as pr #sys.path.append(r'/mnt/e/GitHub_Design/Metalprot') from metalprot.database import database_extract as ldb import itertools ### set up parameters workdir = "/mnt/e/DesignData/ligands/ZN_rcsb/20210608/" metal_sel = 'ion or name NI MN ZN CO CU MG FE' align_sel_backbone = 'name ...
StarcoderdataPython
132178
import sys, math lines = [] for line in sys.stdin: lines.append(line.rstrip('\n')) def toString(horaire): if (horaire == 1440): return "00:00" return str('{:0>2}'.format(math.floor(horaire/60))) + ":" + str('{:0>2}'.format(horaire % 60)) tab = [0] * 60 * 24 horaire1 = 0 horaire2 = 0 horairetemp1 = 0 horairetemp...
StarcoderdataPython
3282974
<reponame>purboday/app.REMAppGroups ''' Event Logger component - log msg format: [{header: value}] ''' from riaps.run.comp import Component import spdlog import capnp import remapp_capnp from datetime import datetime import csv import yaml import os class EventLogger(Component): def __init__(self, configfile): ...
StarcoderdataPython
1746637
<filename>code/kmergrammar/kgutils/report.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- #' % kmergrammar kgmodel #' % <NAME> mm2842 #' % 15th May 2017 #' # Introduction #' Some of the code below is under active development #' ## Required libraries #+ name = 'import_libraries', echo=False import os import sys imp...
StarcoderdataPython
3304586
#!/usr/bin/env python3 import inspect import io import os import pywintypes import win32clipboard from ezpykit import * from expykit.os.clipboard.nt_html import HTMLClipboardMixin class Clipboard(HTMLClipboardMixin, metaclass=SingletonMetaClass): cf_dict = {str.removeprefix(name, 'CF_'): method for name, method...
StarcoderdataPython
1699774
# -*- coding:utf-8 -*- from xlwt import Workbook import json file = open('city.txt','rb') text = file.read().decode('gbk') js = json.loads(text) book = Workbook() sheet = book.add_sheet('city') rownum = 0 js2 = sorted(js) for i in js2: colnum = 0 sheet.write(rownum,colnum,unicode(i)) sheet.wr...
StarcoderdataPython
1794641
from setuptools import setup, Extension setup( ext_modules=[Extension('qjson2json', ['src/qjson.c', 'src/qjsonmodule.c'], depends=['src/qjson.h'], include_dirs=['src'], )], )
StarcoderdataPython
1755828
import numpy as np def test_generate_minimax_move(): """ First checking whether the agent can return an action. Then it asserts the agent will producing valid move. Next, it will test if the agent can produce a winning move given a board state """ from agents.agent_minimax import generate_...
StarcoderdataPython
65930
<reponame>hnwarid/DQLabAcademy # Definisikan class Karyawan class Karyawan: def __init__(self, nama, usia, pendapatan, insentif_lembur): self.nama = nama self.usia = usia self.pendapatan = pendapatan self.pendapatan_tambahan = 0 self.insentif_lembur = insentif_lembur def ...
StarcoderdataPython
1709428
import os import argparse import numpy as np parser = argparse.ArgumentParser() parser.add_argument('--path', type=str, default='../../../data/mask', help='path to the dataset') parser.add_argument('--output', type=str, default='../../../data/edge_connect_flist/mask.flist', help='path to the file list') args = parser....
StarcoderdataPython
3292079
<reponame>Ruteski/CursoPythonOM """ combinations, permutations e product - modulo itertools combinacao - ordem nao importa permutacao - ordem importa ambos nao repetem valores unicos produto - ordem importa e repete valores unicos """ from itertools import combinations, permutations, product pessoas = ['luiz', 'andre'...
StarcoderdataPython
176925
import xbrl from xbrl.const import NS, LinkType, LinkGroup import os.path from urllib.request import pathname2url import datetime def test_loadixbrl(): processor = xbrl.XBRLProcessor() url = "file:" + pathname2url(os.path.abspath(os.path.join(os.path.dirname(__file__), "simple-ixbrl.xhtml"))) report ...
StarcoderdataPython
1699953
import pymongo from PIL import Image import numpy as np import io #User: MedusaUser #PW: <PASSWORD>? #Maybe ... maybe the '?' could cause trouble uri = "mongodb://MedusaUser:P3R5EU?@applis.me/Medusa?authSource=Medusa" def getMedusaImageCollection(): mongoClient=pymongo.MongoClient(uri) medusaDB = mongoClie...
StarcoderdataPython
30911
<reponame>alex/taskmaster """ taskmaster.example ~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ def get_jobs(last=0): # last_job would be sent if state was resumed # from a previous run for i in xrange(last, 20000): yield i def ha...
StarcoderdataPython
3258541
from __future__ import print_function from builtins import input import lib.wicked as WC import lib.database as DB import lib.openhub as OH import lib.copyright as CP import lib.source as SR #import lib.github as GH import lib.unique as UN import lib.pip as PP import os # noinspection PyInterpreter,PyInterpreter def ...
StarcoderdataPython
3367166
# -*- coding: utf-8 -*- # @Time : 2017/10/25 15:37 # @Author : <NAME> # @File : LeakAutoDetection.py import numpy as np import re import itertools import matplotlib.pyplot as plt import graphviz as gv import WebCrawler import gvFunc def createVulDatabase(): # 自动采集得到数据库 f = open("CVEu...
StarcoderdataPython
5719
# # this manager stores directly into the db wit Database update from cloudmesh.mongo.DataBaseDecorator import DatabaseUpdate from cloudmesh.mongo.CmDatabase import CmDatabase from cloudmesh.common.console import Console from cloudmesh.storage.Provider import Provider import os from datetime import datetime class Vd...
StarcoderdataPython
3345928
# 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 copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
StarcoderdataPython
1734658
from abc import abstractmethod from typing import TYPE_CHECKING, Tuple import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.losses import MSE from cephalus.modules.interface import StateKernelModule from cephalus.names import Named if TYPE_CHECKING: from cephalus.kernel import StateKe...
StarcoderdataPython
1736062
<filename>ModelGCNOld.py<gh_stars>0 import torch from sklearn.metrics import accuracy_score from torch.nn import Linear from torch.nn.functional import relu, dropout, log_softmax, nll_loss, leaky_relu from torch_geometric.nn import GCNConv from Result import Result class ModelGCNOld(torch.nn.Module): def __init...
StarcoderdataPython
1725236
<gh_stars>100-1000 """Meraki Devices Collect Meraki Device information using an API Token """ from runners.helpers import log from runners.helpers import db from runners.helpers.dbconfig import ROLE as SA_ROLE from datetime import datetime import requests from urllib.error import HTTPError from .utils import yaml_du...
StarcoderdataPython
3361211
<gh_stars>1-10 """<NAME>wave (2 minutes) Two discontinuities moving towards each other and the results after they interact """ from pysph.sph.scheme import ( GSPHScheme, SchemeChooser, ADKEScheme, GasDScheme ) from pysph.sph.gas_dynamics.psph import PSPHScheme from pysph.sph.gas_dynamics.tsph import TSPHScheme fro...
StarcoderdataPython