code-search-net-mit / code_search_net_mit.sample.jsonl
PiotrSty's picture
CodeSearchNet MIT-only union: Java+Go+Ruby+Python
926ab65 verified
Raw History Blame Contribute Delete
11.3 kB
{"added": "2026-12-05", "author": "pizza/MaterialTabs", "created": "2019", "id": "45a81aae567dbf838f42af55", "license": "MIT", "source": "code_search_net", "text": "Drawing\n\n@Override\n public void draw(@NonNull Canvas canvas) {\n final boolean positionChanged = adapterPositionChanged();\n if (rippleOverlay) {\n super.draw(canvas);\n if (!positionChanged) {\n if (rippleRoundedCornersPx != 0) {\n Path clipPath = new Path();\n RectF rect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());\n clipPath.addRoundRect(rect, rippleRoundedCornersPx, rippleRoundedCornersPx, Path.Direction.CW);\n canvas.clipPath(clipPath);\n }\n canvas.drawCircle(currentCoordinates.x, currentCoordinates.y, radius, paint);\n }\n } else {\n if (!positionChanged) {\n canvas.drawCircle(currentCoordinates.x, currentCoordinates.y, radius, paint);\n }\n super.draw(canvas);\n }\n }", "token_count": 178}
{"added": "2026-12-05", "author": "pebble/pebble-android-sdk", "created": "2019", "id": "71eac428ffb78328f95cb2d6", "license": "MIT", "source": "code_search_net", "text": "Send a message to the connected Pebble to \"customize\" a built-in PebbleKit watch-app. This is intended to allow\nthird-party Android applications to apply custom branding (both name and icon) on the watch without needing to\ndistribute a complete watch-app.\n\n@param context\nThe context used to send the broadcast. (Protip: pass in the ApplicationContext here.)\n@param appType\nThe watch-app to be configured. Options are either\n@param name\nThe custom name to be applied to the watch-app. Names must be less than 32 characters in length.\n@param icon\nThe custom icon to be applied to the watch-app. Icons must be black-and-white bitmaps no larger than 32px\nin either dimension.\n\n@throws IllegalArgumentException\nThrown if the specified name or icon are invalid. {@link PebbleAppType#SPORTS} or {@link\nPebbleAppType#GOLF}.\n\npublic static void customizeWatchApp(final Context context, final PebbleAppType appType,\n final String name, final Bitmap icon) throws IllegalArgumentException {\n\n if (appType == null) {\n throw new IllegalArgumentException(\"app type cannot be null\");\n }\n\n if (name.length() > NAME_MAX_LENGTH) {\n throw new IllegalArgumentException(String.format(\n \"app name exceeds maximum length (%d)\", NAME_MAX_LENGTH));\n }\n\n if (icon.getHeight() > ICON_MAX_DIMENSIONS || icon.getWidth() > ICON_MAX_DIMENSIONS) {\n throw new IllegalArgumentException(String.format(\n \"app icon exceeds maximum dimensions (25px x 25px); got (%dpx x %dpx)\",\n icon.getWidth(), icon.getHeight()));\n }\n\n final Intent customizeAppIntent = new Intent(INTENT_APP_CUSTOMIZE);\n customizeAppIntent.putExtra(CUST_APP_TYPE, appType.ord);\n customizeAppIntent.putExtra(CUST_NAME, name);\n customizeAppIntent.putExtra(CUST_ICON, icon);\n context.sendBroadcast(customizeAppIntent);\n }", "token_count": 399}
{"added": "2026-12-05", "author": "Minecrell/TerminalConsoleAppender", "created": "2019", "id": "b835b2525dda9288256911b9", "license": "MIT", "source": "code_search_net", "text": "Creates a new {@link LoggerNamePatternSelector}.\n\n@param defaultPattern The default pattern to use if no logger name matches\n@param properties The pattern match rules to use\n@param alwaysWriteExceptions Write exceptions even if pattern does not\ninclude exception conversion\n@param disableAnsi If true, disable all ANSI escape codes\n@param noConsoleNoAnsi If true and {@link System#console()} is null,\ndisable ANSI escape codes\n@param config The configuration\n@return The new pattern selector\n\n@PluginFactory\n public static LoggerNamePatternSelector createSelector(\n @Required(message = \"Default pattern is required\") @PluginAttribute(value = \"defaultPattern\") String defaultPattern,\n @PluginElement(\"PatternMatch\") PatternMatch[] properties,\n @PluginAttribute(value = \"alwaysWriteExceptions\", defaultBoolean = true) boolean alwaysWriteExceptions,\n @PluginAttribute(\"disableAnsi\") boolean disableAnsi,\n @PluginAttribute(\"noConsoleNoAnsi\") boolean noConsoleNoAnsi,\n @PluginConfiguration Configuration config) {\n return new LoggerNamePatternSelector(defaultPattern, properties, alwaysWriteExceptions, disableAnsi, noConsoleNoAnsi, config);\n }", "token_count": 238}
{"added": "2026-12-05", "author": "explosion/spaCy", "created": "2019", "id": "88fdd3d9fdd4fc36e1c364fb", "license": "MIT", "source": "code_search_net", "text": "Doc method extension for saving the current state as a displaCy\n visualization.\n\ndef to_html(doc, output=\"/tmp\", style=\"dep\"):\n \"\"\"Doc method extension for saving the current state as a displaCy\n visualization.\n \"\"\"\n # generate filename from first six non-punct tokens\n file_name = \"-\".join([w.text for w in doc[:6] if not w.is_punct]) + \".html\"\n html = displacy.render(doc, style=style, page=True) # render markup\n if output is not None:\n output_path = Path(output)\n if not output_path.exists():\n output_path.mkdir()\n output_file = Path(output) / file_name\n output_file.open(\"w\", encoding=\"utf-8\").write(html) # save to file\n print(\"Saved HTML to {}\".format(output_file))\n else:\n print(html)", "token_count": 188}
{"added": "2026-12-05", "author": "nvbn/thefuck", "created": "2019", "id": "146925ffe194d271c40e0e29", "license": "MIT", "source": "code_search_net", "text": "Yields all available rules.\n\n :type rules_paths: [Path]\n :rtype: Iterable[Rule]\n\ndef get_loaded_rules(rules_paths):\n \"\"\"Yields all available rules.\n\n :type rules_paths: [Path]\n :rtype: Iterable[Rule]\n\n \"\"\"\n for path in rules_paths:\n if path.name != '__init__.py':\n rule = Rule.from_path(path)\n if rule.is_enabled:\n yield rule", "token_count": 91}
{"added": "2026-12-05", "author": "keon/algorithms", "created": "2019", "id": "2883df3065b7b074cc7057ca", "license": "MIT", "source": "code_search_net", "text": "converts a positive integer into a (reversed) linked list.\n for example: give 112\n result 2 -> 1 -> 1\n\ndef convert_to_list(number: int) -> Node:\n \"\"\"\n converts a positive integer into a (reversed) linked list.\n for example: give 112\n result 2 -> 1 -> 1\n \"\"\"\n if number >= 0:\n head = Node(0)\n current = head\n remainder = number % 10\n quotient = number // 10\n\n while quotient != 0:\n current.next = Node(remainder)\n current = current.next\n remainder = quotient % 10\n quotient //= 10\n current.next = Node(remainder)\n return head.next\n else:\n print(\"number must be positive!\")", "token_count": 175}
{"added": "2026-12-05", "author": "go-playground/validator", "created": "2019", "id": "3b358326373ec3a0b8847d4f", "license": "MIT", "source": "code_search_net", "text": "// wrapStructLevelFunc wraps normal StructLevelFunc makes it compatible with StructLevelFuncCtx\n\nfunc wrapStructLevelFunc(fn StructLevelFunc) StructLevelFuncCtx {\n\treturn func(ctx context.Context, sl StructLevel) {\n\t\tfn(sl)\n\t}\n}", "token_count": 52}
{"added": "2026-12-05", "author": "stretchr/testify", "created": "2019", "id": "587750b02e1cde4fdf099208", "license": "MIT", "source": "code_search_net", "text": "// Return specifies the return arguments for the expectation.\n//\n// Mock.On(\"DoSomething\").Return(errors.New(\"failed\"))\n\nfunc (c *Call) Return(returnArguments ...interface{}) *Call {\n\tc.lock()\n\tdefer c.unlock()\n\n\tc.ReturnArguments = returnArguments\n\n\treturn c\n}", "token_count": 58}
{"added": "2026-12-05", "author": "nareix/joy4", "created": "2019", "id": "e114d189b84df4df89fc87e3", "license": "MIT", "source": "code_search_net", "text": "// Check if this sample format is in planar.\n\nfunc (self SampleFormat) IsPlanar() bool {\n\tswitch self {\n\tcase S16P, S32P, FLTP, DBLP:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "token_count": 54}
{"added": "2026-12-05", "author": "Azure/azure-sdk-for-ruby", "created": "2019", "id": "57ca242e682b982b1ad56cac", "license": "MIT", "source": "code_search_net", "text": "Deletes a failover group.\n\n @param resource_group_name [String] The name of the resource group that\n contains the resource. You can obtain this value from the Azure Resource\n Manager API or the portal.\n @param server_name [String] The name of the server containing the failover\n group.\n @param failover_group_name [String] The name of the failover group.\n @param custom_headers [Hash{String => String}] A hash of custom headers that\n will be added to the HTTP request.\n\n @return [MsRestAzure::AzureOperationResponse] HTTP response information.\n\ndef begin_delete_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers:nil)\n begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!\n end", "token_count": 167}
{"added": "2026-12-05", "author": "wvanbergen/request-log-analyzer", "created": "2019", "id": "1cb4e5aca2fd9597d30281bb", "license": "MIT", "source": "code_search_net", "text": "Sets up the numeric value tracker. It will check whether the value and category\n options are set that are used to extract and categorize the values during\n parsing. Two lambda procedures are created for these tasks\n\ndef prepare\n fail \"No value field set up for numeric tracker #{inspect}\" unless options[:value]\n fail \"No categorizer set up for numeric tracker #{inspect}\" unless options[:category]\n\n unless options[:multiple]\n @categorizer = create_lambda(options[:category])\n @valueizer = create_lambda(options[:value])\n end\n\n @number_of_buckets = options[:number_of_buckets] || 1000\n @min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 0.000001\n @max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1_000_000_000\n\n # precalculate the bucket size\n @bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f\n\n @categories = {}\n end", "token_count": 238}
{"added": "2026-12-05", "author": "activescaffold/active_scaffold", "created": "2019", "id": "2f5d15977ae0ce8a0a7460cd", "license": "MIT", "source": "code_search_net", "text": "the way to add items to the set.\n\ndef add(*args)\n args.flatten! # allow [] as a param\n args.each do |arg|\n arg = arg.to_sym if arg.is_a? String\n @set << arg unless @set.include? arg # avoid duplicates\n end\n end", "token_count": 65}