text
string
size
int64
token_count
int64
from random import Random from rstr import Rstr from . import Generator class Regex(Generator): def __init__(self, regex, seed=None): self.gen = Rstr(Random(seed)) self.regex = regex def get_single(self): return self.gen.xeger(self.regex)
273
85
import numpy import math print(math.lcm(0x00eca08bfa42dcad582302232a80813894fd2e4b842dca21eba465619a0d464a9f864ab2e9c0be42367d63c595e81385dcb66bbf8242cddb848969f883af2fbb8c1490a3932c03d15b2d7dfb08dd2c61e05978fbfd337e70ba838574cfe443658910aef9303e968d32351339c14a3c08920a5c1a854cea5af98bd32f1098a2fc5f8a468009c7c063f48c2...
7,081
6,772
su = 0 a = [3,5,6,2,7,1] print(sum(a)) x, y = input("Enter a two value: ").split() x = int(x) y = int(y) su = a[y] + sum(a[:y]) print(su)
138
78
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import unittest import torch from reagent.core.parameters import EvaluationParameters, RLParameters from reagent.core.types import FeatureData, DiscreteDqnInput, ExtraData from reagent.evaluation.evaluator import get_metric...
8,099
2,739
from gym.envs.registration import register register( id='highway-v0', entry_point='highway_env.envs:HighwayEnv', ) register( id='highway-continuous-v0', entry_point='highway_env.envs:HighwayEnvCon', ) register( id='highway-continuous-intrinsic-rew-v0', entry_point='highway_env.envs:HighwayEnv...
717
298
# Twitcaspy # Copyright 2021 Alma-field # See LICENSE for details. # # based on tweepy(https://github.com/tweepy/tweepy) # Copyright (c) 2009-2021 Joshua Roesslein from .auth import AuthHandler from .oauth import OAuth2Basic class AppAuthHandler(AuthHandler): """ Application-only authentication handler ...
700
245
def test_topic_regexp_matching(dequeuer): msg = {'company_name': 'test_company'} actions_1 = tuple(dequeuer.get_actions_for_topic('object__created', msg)) actions_2 = tuple(dequeuer.get_actions_for_topic('object__deleted', msg)) actions_3 = tuple(dequeuer.get_actions_for_topic('otherthing__created', msg...
1,005
338
# Copyright (c) 2020, eQualit.ie inc. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import inspect import logging class ModelInterface(object): def __init__(self): super().__init__() self...
1,352
406
# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 4.3.3) from distutils.core import setup import py2exe import sys # no arguments if len(sys.argv) == 1: sys.argv.append("py2exe") # We need to import the glob module to search for all files. import glob # We need to exclude matplotlib back...
2,253
713
# Find the closest number # Difficulty: Basic   Marks: 1 ''' Given an array of sorted integers. The task is to find the closest value to the given number in array. Array may contain duplicate values. Note: If the difference is same for two values print the value which is greater than the given number. Input: The firs...
1,529
486
import pytest from qcodes.instrument.parameter import Parameter from qcodes.instrument.sweep_values import SweepValues from qcodes.utils.validators import Numbers @pytest.fixture(name='c0') def _make_c0(): c0 = Parameter('c0', vals=Numbers(-10, 10), get_cmd=None, set_cmd=None) yield c0 @pytest.fixture(na...
4,391
1,900
# -*- encoding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from django.conf.urls import patterns, include, url from django_powerdns_api.routers import router urlpatterns = patterns( '', url(r...
350
111
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making GameAISDK available. This source code file is licensed under the GNU General Public License Version 3. For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package. Copyright...
925
272
#!/usr/bin/env python3 """sum_double Given two int values, return their sum. Unless the two values are the same, then return double their sum. sum_double(1, 2) → 3 sum_double(3, 2) → 5 sum_double(2, 2) → 8 source: https://codingbat.com/prob/p141905 """ def sum_double(a: int, b: int) -> int: """Sum Double. ...
579
235
# -*- coding: utf-8 -*- VERSION = (1, 0, 4) __version__ = "1.0.4" __authors__ = ["Stefan Foulis <stefan.foulis@gmail.com>", ]
126
64
#!/usr/bin/env python import argparse from PIL import Image from inky import InkyPHAT print("""Inky pHAT/wHAT: Logo Displays the Inky pHAT/wHAT logo. """) type = "phat" colour = "black" inky_display = InkyPHAT(colour) inky_display.set_border(inky_display.BLACK) img = Image.open("assets/InkypHAT-212x104-bw.png") i...
366
161
from django.test import TestCase from .models import * from django.contrib.auth.models import User # Create your tests here. user = User.objects.get(id=1) profile = Profile.objects.get(id=1) neighbourhood = Neighbourhood.objects.get(id=1) class TestBusiness(TestCase): def setUp(self): self.business=Busin...
1,230
393
import numpy as np import sys,os caffe_root = '/home/yaochuanqi/work/ssd/caffe/' sys.path.insert(0, caffe_root + 'python') import caffe deploy_proto = 'deploy.prototxt' save_model = 'deploy.caffemodel' weights_dir = 'output' box_layers = ['conv_13/expand', 'Conv_1', 'layer_19_2_2', 'layer_19_2_3', 'layer_19...
4,620
1,482
''' This is the exceptions module: ''' ''' Exception of when user do not have the access to certain pages. ''' class CannotAccessPageException(Exception): pass ''' Exception of the first password and the second password does not match during registration. ''' class PasswordsNotMatchingException(Exception): p...
996
255
import airflow as af from airflow.operators.dummy_operator import DummyOperator from datetime import datetime with af.DAG('minimal_dag', start_date=datetime(2016, 1, 1)) as dag: op = DummyOperator(task_id='op') op.dag is dag # True
239
85
# -*- coding: utf-8 -*- import json import os import numpy as np import tensorflow.compat.v1 as tf from src import model, sample, encoder from flask import Flask from flask import request, jsonify import time ######model def interact_model( model_name='run1', seed=None, nsamples=1, batch_size=1, ...
2,567
856
import pickle from io import BytesIO, StringIO from kombu.utils.div import emergency_dump_state class MyStringIO(StringIO): def close(self): pass class MyBytesIO(BytesIO): def close(self): pass class test_emergency_dump_state: def test_dump(self, stdouts): fh = MyBytesIO() ...
1,096
349
""" Copyright 2020 Google LLC 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 https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
3,754
1,108
class TransportContext(object): """ The System.Net.TransportContext class provides additional context about the underlying transport layer. """ def GetChannelBinding(self,kind): """ GetChannelBinding(self: TransportContext,kind: ChannelBindingKind) -> ChannelBinding Retrieves the requested channel...
733
195
""" Helper functions related to json Author: Marc Gallet """ import datetime import decimal import json import uuid import pathlib class JSONEncoder(json.JSONEncoder): """ A custom JSONEncoder that can handle a bit more data types than the one from stdlib. """ def default(self, o): # early ...
1,058
290
# encoding: utf-8 # input data constants MARI_EL = 'Республика Марий Эл' YOSHKAR_OLA = 'Республика Марий Эл, Йошкар-Ола' VOLZHSK = 'Республика Марий Эл, Волжск' VOLZHSK_ADM = 'Республика Марий Эл, Волжский район' MOUNTIN = 'Республика Марий Эл, Горномарийский район' ZVENIGOVO = 'Республика Марий Эл, Звениговский райо...
1,960
1,046
# -*- coding: utf-8 -*- ''' :synopsis: Unit Tests for Windows IIS Module 'module.win_iis' :platform: Windows :maturity: develop versionadded:: Carbon ''' # Import Python Libs from __future__ import absolute_import import json # Import Salt Libs from salt.exceptions import SaltInvocationError from salt...
7,195
2,113
#!/usr/bin/env python # coding: utf-8 # Loader_to_sharepoint.py # # from pathlib import Path import os.path import requests,json,urllib import pandas as pd import collections from collections import defaultdict import xmltodict import getpass from shareplum import Office365 from shareplum.site import Version from sha...
6,217
1,975
#! /usr/bin/python3 # # Copyright (c) 2017 Intel Corporation # # SPDX-License-Identifier: Apache-2.0 # # pylint: disable = missing-docstring import os import socket import commonl.testing import tcfl import tcfl.tc srcdir = os.path.dirname(__file__) ttbd = commonl.testing.test_ttbd(config_files = [ # strip to re...
869
323
import glob,os,stanza,argparse from datetime import datetime # route initiation directory_path = os.getcwd() #stanford tagger initiation nlp = stanza.Pipeline('en') dimDict ={} # type specifiers have = ["have","has","'ve","had","having","hath"] do = ["do","does","did","doing","done"] wp = ["who","whom","whose","whic...
52,309
17,000
from abc import ABC, abstractmethod class AverageCalculator(ABC): def average(self): try: num_items = 0 total_sum = 0 while self.has_next(): total_sum += self.next_item() num_items += 1 if num_items == 0: ra...
1,582
502
from conans import ConanFile, CMake, tools import os dir_path = os.path.dirname(os.path.realpath(__file__)) class LuaConan(ConanFile): name = "Lua" version = "5.3.5" description = "Lua is a powerful, fast, lightweight, embeddable scripting language." # topics can get used for searches, GitHub topics, ...
2,906
951
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import torch import logging import torch.distributed as dist import torch.multiprocessing as mp from torch.utils.data import Dataset, DataLoader, BatchSampler from torch.utils.data.distributed import DistributedSampler from fairseq.tasks.translation ...
3,800
1,265
#!/usr/bin/env python3 """ intermediate yaml to markdown conversion """ import sys import yaml def yaml_to_markdown(yaml, outfile): """Given a list of dicts representing PowerPoint slides -- presumably loaded from a YAML file -- convert to markdown and print the result on the file-like object 'outfile'. ""...
4,555
1,566
""" Copyright Harvey Mudd College MIT License Spring 2020 Contains the Display module of the racecar_core library """ import cv2 as cv import os from nptyping import NDArray from display import Display class DisplayReal(Display): __WINDOW_NAME: str = "RACECAR display window" __DISPLAY: str = ":1" def _...
1,032
329
""" A small toy example demonstrating how the process of computing 1st derivative can be added to the original computation graph to produce an enlarged graph whose back-propagation yields the 2nd derivative. """ import torch x = torch.randn(10, requires_grad=True) exp = torch.exp(x) cos = torch.cos(x) y = exp * co...
749
310
##################################################################### ## Copyright (c) Autodesk, Inc. All rights reserved ## Written by Forge Partner Development ## ## Permission to use, copy, modify, and distribute this software in ## object code form for any purpose and without fee is hereby granted, ## provided that...
1,335
380
from HyperAPI.hdp_api.routes import Resource, Route from HyperAPI.hdp_api.routes.base.version_management import available_since class Nitro(Resource): name = "nitro" class _getForecasts(Route): name = "getForecasts" httpMethod = Route.POST path = "/nitro/projects/{project_ID}/datasets...
4,850
1,584
#!/usr/bin/env python3 # This script sets up a simple loop for periodical attestation of Pyth data from pyth_utils import * from http.client import HTTPConnection from http.server import HTTPServer, BaseHTTPRequestHandler import json import os import re import subprocess import time import threading P2W_ADDRESS = ...
4,883
1,932
import pandas as pd melbourne_file_path = './melbourne_housing_data.csv' melbourne_data = pd.read_csv(melbourne_file_path) melbourne_data.dropna(axis=0) y = melbourne_data.Price melbourne_features = ['Rooms','Bathroom','Landsize','Lattitude','Longtitude'] X = melbourne_data[melbourne_features] X.describe() X.he...
3,644
1,023
# Copyright 2016-2022 The FEAGI Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
3,406
1,009
# ================================================================================ # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use ...
5,286
1,535
import unittest from textwrap import dedent from normalize_sentences import normalize_sentences class NormalizeSentencesTests(unittest.TestCase): """Tests for normalize_sentences.""" maxDiff = 1000 def test_no_sentences(self): sentence = "This isn't a sentence" self.assertEqual(normali...
3,403
983
import atrlib import pandas as pd # module for calculation of data for renko graph def renko(df): d , l , h ,lbo ,lbc,vol=[],[],[],[],[],[] brick_size = atrlib.brick_size(df) volume = 0.0 for i in range(0,len(df)): if i==0: if(df['close'][i]>df['open'][i]): d.append(...
2,673
930
import os import pathlib import requests import shutil import subprocess import time ENV_PATHS = set() def add_path_to_env(path): ENV_PATHS.add(path) def run_command(command, timeout=-1): if type(command) == str: command = str.split(command, ' ') my_env = os.environ.copy() my_env["PATH"] +...
2,846
894
# Copyright (c) 2016-2022 Renata Hodovan, Akos Kiss. # # Licensed under the BSD 3-Clause License # <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>. # This file may not be copied, modified, or distributed except # according to those terms. try: # FIXME: very nasty, but a recent PyGithub version began ...
2,274
703
# -*- coding: utf-8 -*- import sys import os from init_op import read_config # ROOT_PATH = os.path.split(os.path.realpath(__file__))[0] if getattr(sys, 'frozen', None): ROOT_DIR = os.path.dirname(sys.executable) else: ROOT_DIR = os.path.dirname(__file__) VI_CONF_PATH = ROOT_DIR + "\conf\VI_CONF.ini" ST_CON...
2,624
1,573
from django.apps import AppConfig class LinkSmearConfig(AppConfig): name = "linksmear"
93
30
from typing import List from fastapi import APIRouter from fastapi.params import Depends from fastapi import HTTPException, status from sqlalchemy.orm.session import Session from project import schema, models, database, hashing router = APIRouter( prefix="/user", tags=['Users'] ) @router.post('/new') def crea...
2,088
682
# coding=utf-8 # Copyright 2021 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 required by applicab...
17,643
6,273
import os import cv2 import torch from torch.nn import functional as F from torchvision import transforms import torchvision.utils def save_image(img, path): os.makedirs(os.path.dirname(path), exist_ok=True) torchvision.utils.save_image(torch.clip(img, -1, 1), path, normalize=True) def cv2pt(img): img =...
4,293
1,618
def is_triangle(func): def wrapped(sides): if any(i <= 0 for i in sides): return False sum_ = sum(sides) if any(sides[i] > sum_ - sides[i] for i in range(3)): return False return func(sides) return wrapped @is_triangle def is_equilateral(sides): retu...
486
180
#!/usr/bin/env python3 import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import numpy as np # Create data to plot x = np.linspace(0, 10, 100) y1 = np.sin(x) y2 = np.cos(x) # Create a grid gs = gridspec.GridSpec(1, 2) # Create a figure fig = plt.figure(figsize=(16, 6)) # Create axes ax1 = fig.ad...
499
221
import time import urllib import random import logging import requests import datetime from os import sys, path, makedirs from PyQt5.QtCore import Qt, QTimer, QDateTime from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QLabel, QComboBox, QDateTimeEdit, QCheckBox, QLineEdit, \ QRadioButton root_path =...
21,583
6,950
import random import shapely.geometry as sg from locintel.quality.generators.random import RandomRoutePlanGenerator, polygons random.seed(10) class TestRandomRoutePlanGenerator(object): def test_random_route_plan_generator(self): polygon = polygons["berlin"] generator = RandomRoutePlanGenerator(...
1,109
321
import pandas as pd import plotly.graph_objects as go from typing import Union, Optional from pathlib import Path def collate_time(df: pd.DataFrame, columns: Union[str, list[str]], year_range: Union[list, tuple]): if type(columns) == str: columns = [columns] if type(...
3,878
1,309
#! /usr/bin/python import argparse import os from biokbase.probabilistic_annotation.DataParser import DataParser from biokbase.probabilistic_annotation.Helpers import get_config from biokbase import log desc1 = ''' NAME pa-loaddata -- load static database of gene annotations SYNOPSIS ''' desc2 = ''' DES...
2,492
692
# -*- coding: utf-8 -*- # Copyright (C) 2015 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
21,441
6,231
# # Copyright (c) 2013-2020 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache License, Version 2.0 whic...
2,182
563
from pyg_base import acell, cell, cell_func, dictattr, dt, getargspec, passthru, add_, get_cache from pyg_base._cell import cell_output, cell_item, cell_inputs, _updated import pytest from pyg_base import * def test_cell(): c = cell(lambda a:a+1) assert cell_output(c) == ['data'] with pytest.raises(TypeEr...
6,059
2,636
#!/usr/bin/python # coding: utf-8 ###################### # Uwsgi RCE Exploit ###################### # Author: wofeiwo@80sec.com # Created: 2017-7-18 # Last modified: 2018-1-30 # Note: Just for research purpose import sys import socket import argparse import requests def sz(x): s = hex(x if isinstance(x, int) else...
4,379
1,581
""" Views file for the Darklang Django App """ from django.contrib.auth.decorators import login_required from django.http import Http404 from django.shortcuts import redirect from django.template.loader import render_to_string from django.utils.decorators import method_decorator from django.utils.translation import L...
4,169
1,129
# -*- coding=utf-8 -*- import functools import os import signal import sys import threading import time import colorama import cursor import six from .compat import to_native_string from .termcolors import COLOR_MAP, COLORS, colored, DISABLE_COLORS from io import StringIO try: import yaspin except ImportError: ...
13,480
4,021
#!/usr/bin/env python # -*- coding: utf-8 -*- BOT_NAME = 'book' SPIDER_MODULES = ['book.spiders'] NEWSPIDER_MODULE = 'book.spiders' IMAGES_STORE = '../storage/book/' COOKIES_ENABLED = True COOKIE_DEBUG = True LOG_LEVEL = 'INFO' # LOG_LEVEL = 'DEBUG' CONCURRENT_REQUESTS = 100 CONCURRENT_REQUESTS_PER_DOMAIN = 1000 U...
621
299
# coding: mixt from mixt import html def test(): assert str(<Fragment>'''</Fragment>) == """'''"""
105
36
# !/usr/bin/python # -*- coding: utf-8 -*- # @time : 2020/5/27 21:18 # @author : Mo # @function: 统计 from text_analysis.utils.text_common import txt_read, txt_write, load_json, save_json, get_all_dirs_files from text_analysis.conf.path_log import logger from collections import Counter from typing import List, Dict...
6,325
2,630
#coding:utf-8 """ @author : linkin @email : yooleak@outlook.com @date : 2018-10-04 """ import logging from APIserver.apiserver import app from components.collector import Collector from components.validator import Validator from components.detector import Detector from components.scanner ...
1,689
620
import abc import logging from enum import Enum from tqdm import tqdm from ml import np from ml.functions import sigmoid, dot_batch, bernoulli_from_probas _log = logging.getLogger("ml") class UnitType(Enum): GAUSSIAN = 1 BERNOULLI = 2 class RBMSampler(object): """Sampler used in training of RBMs for e...
30,410
9,749
AP = "AP" BP = "BP" ARRIVE = "ARRIVE" NEUROMODULATORS = "NEUROMODULATORS" TARGET = "TARGET" OBSERVE = "OBSERVE" SET_FREQUENCY = "SET_FREQUENCY" DEACTIVATE = "DEACTIVATE" ENCODE_INFORMATION = "ENCODE_INFORMATION"
218
117
"""Command line interface for OolongT""" import argparse import os import sys import typing from textwrap import wrap as wrap_text from ..constants import DEFAULT_LENGTH from ..content import Document from ..files import get_document from ..string import simplify from ..typings import OptionalString, StringList DEFAU...
2,798
833
import sys import os.path import threading import queue import logging import random import copy from paramiko.client import SSHClient import paramiko import re import time import os class USIEngine: def __init__(self, name, host, engine_path, nodes=None, multiPV=1, threads=1, delay=0, dela...
15,123
4,460
import numpy as np import os from source.base import utils_mp from source.base import file_utils def cartesian_dist(vec_x: np.array, vec_y: np.array, axis=1) -> np.ndarray: dist = np.linalg.norm(vec_x - vec_y, axis=axis) return dist def batch_quat_to_rotmat(q, out=None): """ quaternion a + bi + cj ...
9,051
3,544
from django.shortcuts import render from django.views.generic import ListView from contact.models import Profile class Contact(ListView): model = Profile template_name = "contact.html"
194
49
from typing import List import typing from scipy import optimize import sklearn # from sklearn.gaussian_process import kernels from sklearn.gaussian_process.kernels import Kernel, KernelOperator # import torch # from scipy.linalg import solve_triangular, cholesky # from scipy import optimize, stats import numpy as np #...
24,382
8,025
import ctypes import threading from functools import partial from contextlib import nullcontext from copy import deepcopy import multiprocessing as mp from itertools import zip_longest from typing import Iterable import torch import torch.nn as nn import torch.utils.data import torch_xla.core.xla_model as xm import to...
10,112
3,041
import numpy as np import os import argparse import tqdm import pandas as pd import SimpleITK as sitk from medpy import metric def get_args(): parser = argparse.ArgumentParser() parser.add_argument('--file_path', type=str, default='./results/abus_roi/0108_dice_1/') args = parser.parse_args() # save...
1,819
746
from .taxid import TaxId from .uri import URIManager, URIMapper
64
19
# Copyright 2016 Canonical 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 by applicable law or agreed to in writing, s...
4,170
1,393
import numpy as np from copy import copy from .utils.thresholdcurator import ThresholdCurator from .quality_metric import QualityMetric import spiketoolkit as st import spikemetrics.metrics as metrics from spikemetrics.utils import printProgressBar from collections import OrderedDict from sklearn.neighbors import Neare...
5,956
1,953
import json import pymongo import falcon from bson import json_util class NewsSpider1: def __init__(self, **kwargs): self.name = kwargs.get("name", None) self.country = kwargs.get("country", None) self.category = kwargs.get("category", None) self.entryDateParser = kwargs.get("entryDateParser", Non...
1,397
428
# Open3D: www.open3d.org # The MIT License (MIT) # See license file or visit www.open3d.org for details # examples/Python/Advanced/global_registration.py import open3d as o3d import numpy as np import copy def draw_registration_result(source, target, transformation): source_temp = copy.deepcopy(source) targ...
4,152
1,438
import os import argparse import pandas as pd import numpy as np from sklearn.metrics import f1_score, r2_score from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument("--exp_dir", type=str, help="path to directory containing test results", default="/scratch/wdjo224/deep_protei...
2,698
900
import scripts.project_functions
35
10
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jan 13 14:50:24 2021 @author: kunal001 """ import pathlib import pprint import json import logging from ..schema import constraint logger = logging.getLogger(__name__) pp = pprint.PrettyPrinter(indent=4) class PnRConstraintWriter: def __init__(sel...
8,278
2,166
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jan 9 00:00:43 2018 @author: joy """ print(5 + 3) print(9 - 1) print(2 * 4) print(16//2)
157
89
import os from contextlib import ExitStack from pathlib import Path import pytest from synctogit.git_factory import GitError, git_factory def remotes_dump(remote_name, remote): # fmt: off return ( "%(remote_name)s\t%(remote)s (fetch)\n" "%(remote_name)s\t%(remote)s (push)" ) % locals() ...
7,042
2,564
# =============================================================================== # Copyright 2019 ross # # 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/LICE...
2,117
672
import asyncio import threading from .connection import MixerConnection from .utils import get_channel_id from chatrooms import lock class MixerThread(threading.Thread): def __init__(self, **kwargs): super().__init__() self.channel_id = get_channel_id(kwargs.pop("channel_name")) self.mixer...
1,043
297
#! /usr/bin/python3 print("HELLO PYTHON")
44
24
try: with open('proxies.txt', 'r') as file: proxy = [ line.rstrip() for line in file.readlines()] except FileNotFoundError: raise Exception('Proxies.txt not found.')
181
59
from .models import NotificationManager from django.utils.deprecation import MiddlewareMixin class NotificationMiddleware(MiddlewareMixin): def process_request(self, request): if request.user.is_authenticated: notif_id = request.GET.get('notif_id', None) ref = request.GET.get('ref'...
1,577
392
import unittest from laika.helpers import get_constellation, get_prn_from_nmea_id, \ get_nmea_id_from_prn, NMEA_ID_RANGES SBAS_DATA = [ ['S01', 33], ['S02', 34], ['S10', 42], ['S22', 54], ['S23', 55], ['S32', 64], ['S33', 120], ['S64', 151], ['S65', 152...
5,167
2,081
# Author: Frank Cwitkowitz <fcwitkow@ur.rochester.edu> # My imports from . import tools # Regular imports from abc import abstractmethod from copy import deepcopy import numpy as np import os def filter_notes_by_duration(pitches, intervals, threshold=0.): """ Remove notes from a collection which have a dur...
29,969
7,941
from django.contrib import admin from .models import Tasks admin.site.register(Tasks) # Register your models here.
121
35
DILAMI_WEEKDAY_NAMES = { 0: "شمبه", 1: "یکشمبه", 2: "دۊشمبه", 3: "سۊشمبه", 4: "چارشمبه", 5: "پئنشمبه", 6: "جۊمه", } DILAMI_MONTH_NAMES = { 0: "پنجيک", 1: "نؤرۊز ما", 2: "کۊرچ ٚ ما", 3: "أرئه ما", 4: "تیر ما", 5: "مۊردال ما", 6: "شریرما", 7: "أمیر ما", 8: ...
8,046
5,545
import math from inputs.sine import Sine from inputs.timeElapsed import TimeElapsed from utils.number import Number class SineClock(Number): def __init__(self, sine: Sine): self.__sine = sine self.__elapsed = TimeElapsed() def get(self): return self.__sine.at_time(self.__elapsed.get(...
324
106
from django.conf import settings from django.conf.urls import url, include from django.contrib import admin from api.views import index urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api/', include('api.urls')), ] # troubleshooting tool if settings.TOOLBAR: import debug_toolbar urlpatterns ...
667
212
#!flask/bin/python from app import app app.run(host='127.0.0.1',port=8080,debug=True)
86
43
# Copyright (c) 2009 James Aylett <http://tartarus.org/james/computers/django/> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights...
2,572
807
# main imports import numpy as np import sys # image transform imports from PIL import Image from skimage import color from sklearn.decomposition import FastICA from sklearn.decomposition import IncrementalPCA from sklearn.decomposition import TruncatedSVD from numpy.linalg import svd as lin_svd from scipy.signal impo...
24,440
8,936